├── .devcontainer
└── devcontainer-example.json
├── .eslintrc
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── pull_request_template.md
└── workflows
│ ├── main.yml
│ └── wordpressRelease.yml
├── .gitignore
├── .vscode
├── .php-cs-fixer.php
└── settings-example.json
├── Admin
├── LknIntegrationRedeForWoocommerceAdmin.php
├── css
│ └── lkn-integration-rede-for-woocommerce-admin.css
├── images
│ ├── backgroundCardLeft.svg
│ ├── backgroundCardRight.svg
│ ├── linkNacionalLogo.webp
│ └── stars.svg
├── index.php
├── js
│ ├── lkn-integration-rede-for-woocommerce-admin-card.js
│ ├── lkn-integration-rede-for-woocommerce-admin-clear-logs-button.js
│ ├── lkn-integration-rede-for-woocommerce-admin-pro-fields.js
│ ├── lkn-integration-rede-for-woocommerce-admin.js
│ ├── lkn-integration-rede-for-woocommerce-endpoint.js
│ ├── lkn-integration-rede-for-woocommerce-pix-settings.js
│ ├── lkn-integration-rede-for-woocommerce-plugin-rate.js
│ └── lkn-integration-rede-for-woocommerce-settings-layout.js
└── partials
│ └── lkn-integration-rede-for-woocommerce-admin-display.php
├── CHANGELOG.md
├── Includes
├── LknIntegrationRedeForWoocommerce.php
├── LknIntegrationRedeForWoocommerceActivator.php
├── LknIntegrationRedeForWoocommerceDeactivator.php
├── LknIntegrationRedeForWoocommerceHelper.php
├── LknIntegrationRedeForWoocommerceLoader.php
├── LknIntegrationRedeForWoocommerceWcEndpoint.php
├── LknIntegrationRedeForWoocommerceWcMaxipagoCredit.php
├── LknIntegrationRedeForWoocommerceWcMaxipagoCreditBlocks.php
├── LknIntegrationRedeForWoocommerceWcMaxipagoDebit.php
├── LknIntegrationRedeForWoocommerceWcMaxipagoDebitBlocks.php
├── LknIntegrationRedeForWoocommerceWcPixHelper.php
├── LknIntegrationRedeForWoocommerceWcPixRede.php
├── LknIntegrationRedeForWoocommerceWcPixRedeBlocks.php
├── LknIntegrationRedeForWoocommerceWcRede.php
├── LknIntegrationRedeForWoocommerceWcRedeAPI.php
├── LknIntegrationRedeForWoocommerceWcRedeAbstract.php
├── LknIntegrationRedeForWoocommerceWcRedeCredit.php
├── LknIntegrationRedeForWoocommerceWcRedeCreditBlocks.php
├── LknIntegrationRedeForWoocommerceWcRedeDebit.php
├── LknIntegrationRedeForWoocommerceWcRedeDebitBlocks.php
├── index.php
├── templates
│ ├── adminCard
│ │ └── adminSettingsCard.php
│ ├── creditCard
│ │ ├── maxipagoPaymentCreditForm.php
│ │ └── redePaymentCreditForm.php
│ ├── debitCard
│ │ ├── maxipagoPaymentDebitForm.php
│ │ └── redePaymentDebitForm.php
│ └── pix
│ │ ├── paymentPixQRCode.php
│ │ └── pixRedePaymentPaymentFields.php
└── views
│ ├── LknIntegrationRedeForWoocommerceMetaTable.php
│ └── notices
│ ├── html-notice-woocommerce-missing.php
│ └── lkn-integration-rede-for-woocommerce-notice-download.php
├── LICENSE.txt
├── Public
├── LknIntegrationRedeForWoocommercePublic.php
├── css
│ ├── card.css
│ ├── lknIntegrationRedeForWoocommercePublic.css
│ ├── lknIntegrationRedeForWoocommerceSelectStyle.css
│ ├── maxipago
│ │ ├── styleMaxipagoCredit.css
│ │ └── styleMaxipagoDebit.css
│ └── rede
│ │ ├── LknIntegrationRedeForWoocommercePaymentFields.css
│ │ ├── LknIntegrationRedeForWoocommercePix.css
│ │ ├── LknIntegrationRedeForWoocommercePixDivi.css
│ │ ├── styleRedeCredit.css
│ │ └── styleRedeDebit.css
├── images
│ ├── cards
│ │ ├── amex.svg
│ │ ├── diners.svg
│ │ ├── discover.svg
│ │ ├── jcb.svg
│ │ ├── laser.svg
│ │ ├── maestro.svg
│ │ ├── mastercard.svg
│ │ ├── paypal.svg
│ │ ├── unknown.svg
│ │ └── visa.svg
│ ├── maxipago.png
│ ├── share.svg
│ └── telegram.svg
├── index.php
├── js
│ ├── creditCard
│ │ ├── maxipago
│ │ │ ├── lknIntegrationMaxipagoForWoocommerceCheckout.js
│ │ │ ├── lknIntegrationMaxipagoForWoocommerceCheckout.jsx
│ │ │ ├── lknIntegrationMaxipagoForWoocommerceCheckoutCompiled.js
│ │ │ ├── lknIntegrationMaxipagoForWoocommerceCheckoutCompiled.js.LICENSE.txt
│ │ │ └── wooMaxipagoCredit.js
│ │ └── rede
│ │ │ ├── lknIntegrationRedeForWoocommerceCheckout.js
│ │ │ ├── lknIntegrationRedeForWoocommerceCheckout.jsx
│ │ │ ├── lknIntegrationRedeForWoocommerceCheckoutCompiled.js
│ │ │ ├── lknIntegrationRedeForWoocommerceCheckoutCompiled.js.LICENSE.txt
│ │ │ └── wooRedeCredit.js
│ ├── debitCard
│ │ ├── maxipago
│ │ │ ├── lknIntegrationMaxipagoForWoocommerceCheckout.js
│ │ │ ├── lknIntegrationMaxipagoForWoocommerceCheckout.jsx
│ │ │ ├── lknIntegrationMaxipagoForWoocommerceCheckoutCompiled.js
│ │ │ ├── lknIntegrationMaxipagoForWoocommerceCheckoutCompiled.js.LICENSE.txt
│ │ │ └── wooMaxipagoDebit.js
│ │ └── rede
│ │ │ ├── lknIntegrationRedeForWoocommerceCheckout.js
│ │ │ ├── lknIntegrationRedeForWoocommerceCheckout.jsx
│ │ │ ├── lknIntegrationRedeForWoocommerceCheckoutCompiled.js
│ │ │ ├── lknIntegrationRedeForWoocommerceCheckoutCompiled.js.LICENSE.txt
│ │ │ └── wooRedeDebit.js
│ ├── fixInfiniteLoading.js
│ ├── jquery.card.js
│ ├── lknIntegrationRedeForWoocommercePublic.js
│ └── pix
│ │ ├── LknIntegrationRedeForWoocommercePix.js
│ │ └── LknIntegrationRedeForWoocommercePixRede.js
└── partials
│ └── lkn-integration-rede-for-woocommerce-public-display.php
├── README.md
├── README.txt
├── composer.json
├── composer.lock
├── index.php
├── integration-rede-for-woocommerce.php
├── languages
├── integration-rede-for-woocommerce-pt_BR.po
└── lkn-integration-rede-for-woocommerce.pot
├── lkn-integration-rede-for-woocommerce-file.php
├── package-lock.json
├── package.json
├── uninstall.php
└── webpack.config.js
/.devcontainer/devcontainer-example.json:
--------------------------------------------------------------------------------
1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2 | {
3 | "name": "PHP",
4 | // https: //github.com/devcontainers/images/tree/main/src/php
5 | "image": "mcr.microsoft.com/vscode/devcontainers/php:8.1",
6 | "features": {
7 | // https://github.com/devcontainers/features/tree/main/src/node
8 | "ghcr.io/devcontainers/features/node:1": {
9 | "version": "18.14.0",
10 | "nvmVersion": "0.39.3"
11 | }
12 | },
13 | "mounts": [
14 | {
15 | "source": "/home/{yourusername}/wordpress",
16 | "target": "/home/vscode/_wordpress",
17 | "type": "bind"
18 | }
19 | ],
20 | "postCreateCommand": "npm install",
21 | "customizations": {
22 | "vscode": {
23 | "extensions": [
24 | "junstyle.php-cs-fixer",
25 | "bmewburn.vscode-intelephense-client",
26 | "neilbrayfield.php-docblocker",
27 | "dbaeumer.vscode-eslint",
28 | "aswinkumar863.smarty-template-support",
29 | "MehediDracula.php-namespace-resolver"
30 | ],
31 | "settings": {
32 | "[html]": {
33 | "editor.rulers": [
34 | 120
35 | ],
36 | "editor.tabSize": 4
37 | },
38 | "[javascript]": {
39 | "editor.rulers": [
40 | 80,
41 | 120
42 | ]
43 | },
44 | "[php]": {
45 | "editor.defaultFormatter": "junstyle.php-cs-fixer",
46 | "editor.rulers": [
47 | 80,
48 | 120
49 | ]
50 | },
51 | "[smarty]": {
52 | "editor.rulers": [
53 | 120
54 | ],
55 | "editor.tabSize": 4,
56 | "editor.wrappingIndent": "deepIndent",
57 | "editor.wrappingStrategy": "advanced"
58 | },
59 | "editor.codeActionsOnSave": {
60 | "source.fixAll.eslint": true
61 | },
62 | "editor.formatOnSave": true,
63 | "files.encoding": "utf8",
64 | "files.eol": "\n",
65 | "html.format.wrapAttributes": "force-expand-multiline",
66 | "html.format.wrapAttributesIndentSize": 4,
67 | "html.format.wrapLineLength": 120,
68 | "intelephense.environment.documentRoot": "src",
69 | "intelephense.environment.phpVersion": "8.1",
70 | "intelephense.files.associations": [
71 | "*.php"
72 | ],
73 | "namespaceResolver.showMessageOnStatusBar": true,
74 | "namespaceResolver.sortAlphabetically": true,
75 | "namespaceResolver.sortNatural": true,
76 | "namespaceResolver.sortOnSave": true,
77 | "php-cs-fixer.autoFixByBracket": true,
78 | "php-cs-fixer.autoFixBySemicolon": true,
79 | "php-cs-fixer.config": ".php-cs-fixer.php",
80 | "php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar",
81 | "php-cs-fixer.formatHtml": true,
82 | "php-cs-fixer.onsave": true,
83 | "php-docblocker.alignParams": true,
84 | "php-docblocker.alignReturn": true,
85 | "php-docblocker.useShortNames": true,
86 | "php.suggest.basic": false,
87 | "php.validate.enable": false,
88 | "smarty.highlight": true
89 | }
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "es2021": true
5 | },
6 | "extends": "standard",
7 | "parserOptions": {
8 | "ecmaVersion": "latest",
9 | "sourceType": "module"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ## Descreva o bug
2 | Uma descrição clara e concisa do que é o bug.
3 |
4 | ## Informação do sistema
5 | - PHP: [ex. 8.1]
6 | - WooCommerce: [ex. 8.3.1]
7 | - WordPress: [ex. 6.1]
8 |
9 | ## Passos para reproduzir
10 | Etapas para reproduzir o comportamento:
11 | 1. Vá para '...'
12 | 2. Clique em '....'
13 | 3. Role para baixo até '....'
14 | 4. Ver erro
15 |
16 | ## Comportamento esperado
17 | Uma descrição clara e concisa do que você esperava que acontecesse.
18 |
19 | ## Capturas de tela
20 | Se aplicável, adicione capturas de tela para ajudar a explicar seu problema.
21 |
22 | ## Critérios de Aceitação
23 |
24 |
25 |
26 | - [ ] Algo acontece quando uma ação é executada.
27 | - [ ] Algo não acontece quando uma ação é executada.
28 | - [ ] O comportamento de correção no Componente A não afeta o comportamento existente no Componente B.
29 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ## Sua solicitação de recurso está relacionada a um problema? Por favor descreva
2 | Uma descrição clara e concisa de qual é o problema. Ex. Eu sempre fico frustrado quando [...]
3 |
4 | ## Descreva a solução que você gostaria
5 | Uma descrição clara e concisa do que você quer que aconteça.
6 |
7 | ## Descreva as alternativas que você considerou
8 | Uma descrição clara e concisa de quaisquer soluções ou recursos alternativos que você considerou.
9 |
10 | ## Critérios de Aceitação
11 |
12 |
13 |
14 | - [ ] Algo acontece quando uma ação é executada.
15 | - [ ] Algo não acontece quando uma ação é executada.
16 | - [ ] O comportamento de correção no Componente A não afeta o comportamento existente no Componente B.
17 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ## Changelog
2 |
3 |
4 |
5 | - Adicionar nova configuração para...
6 |
7 | ## Conferir
8 | - [ ] Atualizar versão hardcoded
9 | - [ ] Atualizar README com notas
10 | - [ ] Atualizar CHANGELOG
11 | - [ ] Notificar @colab com changelog
12 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: Generate new release for plugin
2 |
3 | on:
4 | pull_request:
5 | types: [ closed ]
6 | branches: [ main ]
7 |
8 | env:
9 | PLUGIN_NAME: woo-rede
10 | DIR_NAME: woo-rede
11 | PHP_VERSION: "7.4"
12 | DEPLOY_TAG: "3.9.2"
13 |
14 | jobs:
15 | release-build:
16 | runs-on: ubuntu-latest
17 | permissions:
18 | contents: write
19 | steps:
20 | - uses: actions/checkout@v3
21 |
22 | - name: Run composer install
23 | uses: php-actions/composer@v6
24 | with:
25 | php_version: ${{ env.PHP_VERSION }}
26 | working_dir: "."
27 | args: --ignore-platform-reqs
28 | command: install
29 | dev: no
30 |
31 | - name: Executar Plugin Check com configurações personalizadas
32 | uses: wordpress/plugin-check-action@v1
33 | with:
34 | build-dir: './'
35 | exclude-directories: 'node_modules,vendor,.eslintrc'
36 | ignore-codes: |
37 | WordPress.WP.I18n.TextDomainMismatch
38 | WordPress.Security.NonceVerification.Missing
39 | WordPress.Security.NonceVerification.Recommended
40 | WordPress.DB.SlowDBQuery.slow_db_query_meta_key
41 | WordPress.DB.SlowDBQuery.slow_db_query_meta_value
42 | trademarked_term
43 | textdomain_mismatch
44 | hidden_files
45 | categories: |
46 | performance
47 | accessibility
48 | general
49 | plugin_repo
50 | security
51 | strict: true
52 |
53 | # Add plugin files to a root directory
54 | - name: Prepare plugin folder
55 | run: |
56 | mkdir -p dist
57 | mkdir -p build/${{ env.PLUGIN_NAME }}
58 | mv ./Admin ./Includes ./languages ./Public *.php *.txt ./build/${{ env.PLUGIN_NAME }}
59 | cp -r vendor ./build/${{ env.PLUGIN_NAME }}/vendor
60 | find ./build -type f -exec chmod 0644 {} +
61 | find ./build -type d -exec chmod 0755 {} +
62 |
63 | # Compact plugin as .zip
64 | - name: Archive Release
65 | uses: thedoctor0/zip-release@master
66 | with:
67 | type: 'zip'
68 | path: '.'
69 | directory: 'build'
70 | filename: '${{ env.PLUGIN_NAME }}.zip'
71 | exclusions: '*.git* /*node_modules/* .editorconfig'
72 |
73 | - name: Move .zip to custom location
74 | run: |
75 | mv ./build/${{ env.PLUGIN_NAME }}.zip ./dist/
76 |
77 | # Update version tag
78 | - name: Bump version and push tag
79 | id: tag_version
80 | uses: mathieudutour/github-tag-action@v6.0
81 | with:
82 | github_token: ${{ secrets.GITHUB_TOKEN }}
83 | custom_tag: ${{ env.DEPLOY_TAG }}
84 |
85 | # Generate new release
86 | - name: Generate new Release
87 | uses: ncipollo/release-action@v1
88 | with:
89 | artifacts: "dist/${{ env.PLUGIN_NAME }}.zip"
90 | token: ${{ secrets.GITHUB_TOKEN }}
91 | commit: "main"
92 | draft: true
93 | tag: ${{ steps.tag_version.outputs.new_tag }}
94 | name: Release ${{ steps.tag_version.outputs.new_tag }}
95 |
--------------------------------------------------------------------------------
/.github/workflows/wordpressRelease.yml:
--------------------------------------------------------------------------------
1 | name: Deploy Plugin to WordPress.org
2 |
3 | on:
4 | workflow_dispatch:
5 |
6 | env:
7 | PLUGIN_NAME: woo-rede
8 | PHP_VERSION: "7.4"
9 | DEPLOY_TAG: "3.9.2"
10 |
11 | jobs:
12 | deploy-to-wp:
13 | runs-on: ubuntu-latest
14 | steps:
15 | - name: Checkout branch main
16 | uses: actions/checkout@v3
17 | with:
18 | ref: main
19 |
20 | - name: Run composer install
21 | uses: php-actions/composer@v6
22 | with:
23 | php_version: ${{ env.PHP_VERSION }}
24 | working_dir: "."
25 | args: --ignore-platform-reqs
26 | command: install
27 | dev: no
28 |
29 | - name: Prepare plugin folder
30 | run: |
31 | mkdir -p build/${{ env.PLUGIN_NAME }}
32 | mv ./Admin ./Includes ./languages ./Public *.php *.txt ./build/${{ env.PLUGIN_NAME }}
33 | cp -r vendor build/${{ env.PLUGIN_NAME }}/vendor
34 | find ./build -type f -exec chmod 0644 {} +
35 | find ./build -type d -exec chmod 0755 {} +
36 |
37 | - name: Deploy para WordPress.org
38 | uses: 10up/action-wordpress-plugin-deploy@stable
39 | env:
40 | VERSION: ${{ env.DEPLOY_TAG }}
41 | SLUG: woo-rede
42 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
43 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
44 | ASSETS_DIR: .wordpress-org
45 | BUILD_DIR: build/${{ env.PLUGIN_NAME }}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .vscode/settings.json
3 | vendor
4 | .devcontainer/devcontainer.json
5 | Includes/logs/*.log
6 | wp-content
--------------------------------------------------------------------------------
/.vscode/.php-cs-fixer.php:
--------------------------------------------------------------------------------
1 | setRules(array(
12 | 'short_scalar_cast' => true,
13 | 'visibility_required' => true,
14 | 'elseif' => true,
15 | 'no_superfluous_elseif' => true,
16 | 'align_multiline_comment' => array('comment_type' => 'phpdocs_like'),
17 | 'array_syntax' => array('syntax' => 'long'),
18 | 'binary_operator_spaces' => true,
19 | 'blank_line_after_opening_tag' => false,
20 | 'braces' => array(
21 | 'position_after_functions_and_oop_constructs' => 'same',
22 | ),
23 | 'cast_spaces' => true,
24 | 'class_attributes_separation' => array(
25 | 'elements' => array(
26 | 'const' => 'one',
27 | 'method' => 'one',
28 | 'property' => 'only_if_meta',
29 | ),
30 | ),
31 | 'class_definition' => array('single_line' => true),
32 | 'class_keyword_remove' => true,
33 | 'concat_space' => array('spacing' => 'one'),
34 | 'control_structure_continuation_position' => true,
35 | 'dir_constant' => true,
36 | 'fully_qualified_strict_types' => true,
37 | 'global_namespace_import' => false,
38 | 'include' => true,
39 | 'list_syntax' => array('syntax' => 'long'),
40 | 'lowercase_cast' => true,
41 | 'lowercase_static_reference' => true,
42 | 'magic_constant_casing' => true,
43 | 'magic_method_casing' => true,
44 | 'method_chaining_indentation' => true,
45 | 'native_constant_invocation' => true,
46 | 'native_function_casing' => true,
47 | 'native_function_type_declaration_casing' => true,
48 | 'new_with_braces' => true,
49 | 'no_alternative_syntax' => array('fix_non_monolithic_code' => false),
50 | 'no_blank_lines_after_class_opening' => false,
51 | 'no_blank_lines_after_phpdoc' => true,
52 | 'no_empty_comment' => true,
53 | 'no_extra_blank_lines' => array(
54 | 'tokens' => array(
55 | 'continue',
56 | 'extra',
57 | 'parenthesis_brace_block',
58 | 'square_brace_block',
59 | 'throw',
60 | 'use',
61 | ),
62 | ),
63 | 'no_spaces_around_offset' => array('positions' => array('outside')),
64 | 'no_spaces_inside_parenthesis' => false,
65 | 'not_operator_with_space' => true,
66 | // 'not_operator_with_successor_space' => true,
67 | 'phpdoc_tag_casing' => true,
68 | 'phpdoc_types_order' => array(
69 | 'null_adjustment' => 'always_last',
70 | 'sort_algorithm' => 'none',
71 | ),
72 | 'single_line_throw' => true,
73 | 'strict_param' => true,
74 | 'trim_array_spaces' => true,
75 | // WPCS 3.0 proposal, yoda style is optional
76 | 'yoda_style' => array(
77 | 'always_move_variable' => true,
78 | 'equal' => true,
79 | 'identical' => true,
80 | 'always_move_variable' => true,
81 | ),
82 | 'modernize_types_casting' => true,
83 | 'final_class' => false,
84 | 'final_internal_class' => false,
85 | 'final_public_method_for_abstract_class' => false,
86 | 'void_return' => true,
87 | 'logical_operators' => true,
88 | 'array_indentation' => true,
89 | 'whitespace_after_comma_in_array' => array(
90 | 'ensure_single_space' => true,
91 | ),
92 | 'method_argument_space' => array(
93 | 'keep_multiple_spaces_after_comma' => false,
94 | 'on_multiline' => 'ensure_fully_multiline',
95 | ),
96 | 'native_function_invocation' => false,
97 | 'native_constant_invocation' => false
98 | ))
99 | ->setIndent(' ')
100 | ->setLineEnding("\n")
101 | ->setRiskyAllowed(true)
102 | ;
103 |
--------------------------------------------------------------------------------
/.vscode/settings-example.json:
--------------------------------------------------------------------------------
1 | {
2 | "intelephense.environment.phpVersion": "7.4",
3 | //For autocomplete
4 | "intelephense.environment.includePaths": [
5 | "/home/vscode/_wordpress"
6 | ]
7 | }
--------------------------------------------------------------------------------
/Admin/css/lkn-integration-rede-for-woocommerce-admin.css:
--------------------------------------------------------------------------------
1 | /**
2 | * All of the CSS for your admin-specific functionality should be
3 | * included in this file.
4 | */
5 |
6 | .lowOpacity {
7 | opacity: 0.5;
8 | }
9 |
10 | textarea:disabled {
11 | resize: none;
12 | }
13 |
14 | .lknIntegrationRedeForWoocommerceTooltiptext {
15 | visibility: hidden;
16 | padding: 0.618em 1em;
17 | background-color: #333;
18 | color: #fff;
19 | text-align: center;
20 | font-size: .8em;
21 | border-radius: 3px;
22 | box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
23 | position: absolute;
24 | z-index: 1;
25 | transform: translateX(57%);
26 | margin-left: -100px;
27 | margin-top: 17px;
28 | opacity: 0;
29 | transition: opacity 0.3s;
30 | font-weight: normal
31 | }
32 |
33 | #lknIntegrationRedeForWoocommerceTooltipSpan:hover+.lknIntegrationRedeForWoocommerceTooltiptext {
34 | visibility: visible;
35 | opacity: 1;
36 | }
37 |
38 | .lknIntegrationRedeForWoocommerceBecomePRO {
39 | text-decoration: none;
40 | color: #FF0D08;
41 | font-size: 0.84rem;
42 | font-weight: bold;
43 | font-family: "Inter", sans-serif;
44 | }
45 |
46 | .lknIntegrationRedeForWoocommerceBecomePRO:hover {
47 | color: #FF0D08;
48 | }
49 |
50 | #lknIntegrationRedeForWoocommerceSettingsLayoutDiv {
51 | padding: 10px 24px;
52 | background-color: #FFFFFF;
53 | border-radius: 10px;
54 | }
55 |
56 | #lknIntegrationRedeForWoocommerceSettingsLayoutMenu {
57 | height: 27px;
58 | }
59 |
60 | #lknIntegrationRedeForWoocommerceSettingsLayoutMenu a:first-of-type {
61 | margin: 0px !important;
62 | }
63 |
64 | #lknIntegrationRedeForWoocommerceSettingsLayoutMenu a {
65 | height: 22px !important;
66 | border: none;
67 | background-color: #F0F0F1;
68 | color: #9A9A9A;
69 | }
70 |
71 | #lknIntegrationRedeForWoocommerceSettingsLayoutMenu a:hover {
72 | color: black;
73 | }
74 |
75 | #lknIntegrationRedeForWoocommerceSettingsLayoutMenu a.nav-tab.nav-tab-active {
76 | margin-top: 1.5px !important;
77 | color: black;
78 | }
79 |
80 | #lknIntegrationRedeForWoocommerceSettingsCard {
81 | color: white;
82 | max-width: 370px;
83 | width: fit-content;
84 | height: fit-content;
85 | background-color: #121519;
86 | border-radius: 10px;
87 | margin-bottom: 150px;
88 | background-position: right bottom, left top calc(15px);
89 | background-repeat: no-repeat;
90 | display: flex;
91 | flex-direction: column;
92 | padding: 15px 45px 15px 20px;
93 | box-sizing: border-box;
94 | gap: 20px;
95 | }
96 |
97 | #lknIntegrationRedeForWoocommerceDivLogo {
98 | display: flex;
99 | flex-direction: column;
100 | gap: 6px;
101 | font-family: inter;
102 | font-weight: 500;
103 | }
104 |
105 | #lknIntegrationRedeForWoocommerceDivLogo p {
106 | margin: 0;
107 | font-size: x-small;
108 | }
109 |
110 | #lknIntegrationRedeForWoocommerDivLinks {
111 | display: flex;
112 | justify-content: space-between;
113 | gap: 6%;
114 | }
115 |
116 | #lknIntegrationRedeForWoocommerDivLinks div {
117 | display: flex;
118 | flex-direction: column;
119 | gap: 5px;
120 | font-family: 'Inter';
121 | }
122 |
123 | #lknIntegrationRedeForWoocommerceSettingsCard a {
124 | text-decoration: none;
125 | color: inherit;
126 | background: none;
127 | border: none;
128 | padding: 0;
129 | margin: 0;
130 | font: inherit;
131 | cursor: pointer;
132 | display: flex;
133 | align-items: center;
134 | gap: 2px;
135 | font-size: small;
136 | }
137 |
138 | #lknIntegrationRedeForWoocommerDivLinks a b {
139 | color: #D1D838;
140 | font-size: small;
141 | }
142 |
143 | #lknIntegrationRedeForWoocommerceSettingsCard img {
144 | height: 25px;
145 | }
146 |
147 | #lknIntegrationRedeForWoocommerceSettingsCardTable {
148 | display: flex;
149 | align-items: center;
150 | }
151 |
152 | #lknIntegrationRedeForWoocommerStarsDiv img {
153 | height: 10px;
154 | }
155 |
156 | #lknIntegrationRedeForWoocommerStarsDiv {
157 | width: fit-content;
158 | }
159 |
160 |
161 | #lknIntegrationRedeForWoocommerStarsDiv a {
162 | flex-direction: column;
163 | }
164 |
165 | #lknIntegrationRedeForWoocommerStarsDiv p {
166 | margin: 0;
167 | font-size: x-small;
168 | font-family: 'Inter';
169 | width: 100%;
170 | }
171 |
172 | #lknIntegrationRedeForWoocommerDivContent {
173 | display: flex;
174 | flex-direction: column;
175 | gap: 20px;
176 | }
177 |
178 | #lknIntegrationRedeForWoocommerceSettingsCard {
179 | margin-bottom: 125px;
180 | gap: 25px;
181 | }
182 |
183 | /* Endpoint */
184 | #integrationwoocommerceRedePixEndpointField {
185 | display: flex;
186 | gap: 40px;
187 | }
188 |
189 | #integrationwoocommerceRedePixEndpointAlert {
190 | display: flex;
191 | gap: 10px;
192 | align-items: center;
193 | }
194 |
195 | #woocommerce_integration_rede_pix_clear_order_records,
196 | #woocommerce_rede_credit_clear_order_records,
197 | #woocommerce_rede_debit_clear_order_records,
198 | #woocommerce_maxipago_credit_clear_order_records,
199 | #woocommerce_maxipago_debit_clear_order_records
200 | {
201 | display: flex;
202 | justify-content: center;
203 | width: fit-content;
204 | padding: 0px 20px 0px 20px;
205 | }
206 |
207 | #lknWcRedeOrderLogs pre {
208 | padding: 5px;
209 | background-color: #D9D9D9;
210 | width: fit-content;
211 | border-radius: 4px;
212 | margin: 0;
213 | white-space: pre-wrap
214 | }
215 |
216 | #lknWcRedeOrderLogs pre{
217 | padding: 10px;
218 | background-color: #D9D9D9 !important;
219 | width: fit-content;
220 | max-width: 96%;
221 | border-radius: 4px;
222 | margin: 0;
223 | white-space: pre-wrap;
224 | overflow-x: auto;
225 | }
226 |
227 | #lknWcRedeOrderLogs h3{
228 | color: #333;
229 | font-size: 14px;
230 | font-weight: bold;
231 | }
232 |
233 | #lknWcRedeOrderLogs div{
234 | display: flex;
235 | gap: 6px;
236 | align-items: center;
237 | }
238 |
239 | #lknWcRedeOrderLogs pre{
240 | padding: 10px;
241 | background-color: #D9D9D9 !important;
242 | width: fit-content;
243 | max-width: 96%;
244 | border-radius: 4px;
245 | margin: 0;
246 | white-space: pre-wrap;
247 | overflow-x: auto;
248 | }
249 |
250 | #lknWcRedeOrderLogs h3{
251 | color: #333;
252 | font-size: 14px;
253 | font-weight: bold;
254 | }
255 |
256 | #lknWcRedeOrderLogs div{
257 | display: flex;
258 | gap: 6px;
259 | align-items: center;
260 | }
261 |
262 | @media (max-width: 1205px) {
263 | #lknIntegrationRedeForWoocommerceSettingsCardTable {
264 | flex-direction: column;
265 | align-items: flex-start;
266 | }
267 |
268 | #lknIntegrationRedeForWoocommerceSettingsCard {
269 | margin-top: 25px;
270 | margin-bottom: 15px;
271 | }
272 |
273 | }
274 |
275 | @media (max-width: 782px) {
276 | .lknIntegrationRedeForWoocommerceTooltiptext {
277 | transform: translateX(-20%);
278 | margin-left: 0px;
279 | }
280 | }
--------------------------------------------------------------------------------
/Admin/images/linkNacionalLogo.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinkNacional/integration-rede-for-woocommerce/204f760bf740bddb103aa4565250eac60ea025c8/Admin/images/linkNacionalLogo.webp
--------------------------------------------------------------------------------
/Admin/images/stars.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/Admin/index.php:
--------------------------------------------------------------------------------
1 | {
60 | if (window.innerWidth <= 1205) {
61 | wcForm.appendChild(cardDiv)
62 | } else {
63 | secondFormTable.id = 'lknIntegrationRedeForWoocommerceSettingsCardTable'
64 | secondFormTable.appendChild(cardDiv)
65 | }
66 | }
67 |
68 | window.addEventListener('resize', adjustCardDivPosition)
69 | }
70 | })
71 | })(jQuery)
72 |
--------------------------------------------------------------------------------
/Admin/js/lkn-integration-rede-for-woocommerce-admin-clear-logs-button.js:
--------------------------------------------------------------------------------
1 | const lknWcRedeUrlParams = new URLSearchParams(window.location.search)
2 | const lknWcRedeSection = lknWcRedeUrlParams.get('section')
3 | // Dom loaded
4 |
5 | // Dom carregado
6 |
7 | document.addEventListener('DOMContentLoaded', function () {
8 | const lknWcRedeValidateButton = document.querySelector(`#woocommerce_${lknWcRedeSection}_clear_order_records`)
9 | const lknWcRedeShowOrderLogs = document.querySelector(`#woocommerce_${lknWcRedeSection}_show_order_logs`)
10 | const lknWcRedeDebug = document.querySelector(`#woocommerce_${lknWcRedeSection}_debug`)
11 |
12 | function changeShowOrderLogs() {
13 | if(!lknWcRedeDebug.checked) {
14 | lknWcRedeShowOrderLogs.checked = false
15 | lknWcRedeShowOrderLogs.disabled = true
16 | }
17 | else{
18 | lknWcRedeShowOrderLogs.disabled = false
19 | }
20 | }
21 |
22 | if(lknWcRedeDebug && lknWcRedeShowOrderLogs) {
23 | changeShowOrderLogs()
24 | lknWcRedeDebug.onchange = () => {
25 | changeShowOrderLogs()
26 | }
27 | }
28 |
29 |
30 | const lknWcRedeForValidateButton = document.querySelector(`label[for="woocommerce_${lknWcRedeSection}_clear_order_records"]`)
31 | if (lknWcRedeForValidateButton) {
32 | lknWcRedeForValidateButton.removeAttribute('for')
33 | }
34 |
35 | if (lknWcRedeValidateButton) {
36 | lknWcRedeValidateButton.value = lknWcRedeTranslations.clearLogs
37 | lknWcRedeValidateButton.addEventListener('click', function () {
38 | lknWcRedeValidateButton.disabled = true
39 | lknWcRedeValidateButton.className = lknWcRedeValidateButton.className + ' is-busy'
40 |
41 | if (confirm(lknWcRedeTranslations.alertText)) {
42 | jQuery.ajax({
43 | type: 'DELETE',
44 | url: wpApiSettings.root + 'redeIntegration/clearOrderLogs',
45 | contentType: 'application/json',
46 | success: function (status) {
47 | lknWcRedeValidateButton.disabled = false
48 | location.reload()
49 | },
50 | error: function (error) {
51 | console.error(error)
52 | lknWcRedeValidateButton.disabled = false
53 | lknWcRedeValidateButton.className = lknWcRedeValidateButton.className.replace(' is-busy', '')
54 | }
55 | })
56 | }
57 | })
58 | }
59 | })
--------------------------------------------------------------------------------
/Admin/js/lkn-integration-rede-for-woocommerce-admin.js:
--------------------------------------------------------------------------------
1 | (function ($) {
2 | $(window).load(function () {
3 | const adminPage = lknFindGetParameter('section')
4 | const pluginPages = [
5 | 'maxipago_credit',
6 | 'maxipago_debit',
7 | 'maxipago_pix',
8 | 'rede_credit',
9 | 'rede_debit',
10 | 'rede_pix',
11 | 'integration_rede_pix'
12 | ]
13 | if (adminPage && pluginPages.includes(adminPage)) {
14 | const wcForm = document.getElementById('mainform')
15 | // Pega sempre o ultimo form-table para mostraro link
16 |
17 | const noticeDiv = document.createElement('div')
18 | noticeDiv.setAttribute('style', 'background-color: #fcf9e8;color: #646970;border: solid 1px #d3d3d3;border-left: 4px #dba617 solid;font-size: 16px;margin-top: 10px;')
19 |
20 | noticeDiv.innerHTML = '' + lknPhpVariables.freeHost + ''
21 | noticeDiv.id = 'lknIntegrationRedeForWoocommerceSettingsNoticeDiv'
22 | const lknCieloNoticeDiv = document.createElement('div')
23 | lknCieloNoticeDiv.setAttribute('style', 'padding: 10px 5px;background-color: #fcf9e8;color: #646970;border: solid 1px lightgrey;border-left-color: #dba617;border-left-width: 4px;font-size: 14px;margin-top: 10px;')
24 | lknCieloNoticeDiv.setAttribute('id', 'lkn-cielo-pro-notice')
25 | if (adminPage !== 'integration_rede_pix') {
26 | lknCieloNoticeDiv.innerHTML = '
' + lknPhpVariables.title + '
' +
27 | '' + lknPhpVariables.desc + '' +
28 | '' +
29 | '- ' + lknPhpVariables.capture + '
' +
30 | '- ' + lknPhpVariables.tax + '
' +
31 | '- ' + lknPhpVariables.css + '
' +
32 | '- ' + lknPhpVariables.pix + '
' +
33 | '
'
34 | wcForm.append(lknCieloNoticeDiv)
35 |
36 | const submitButton = wcForm.querySelector('button[type="submit"]').parentElement
37 | if (submitButton) {
38 | submitButton.insertAdjacentHTML('beforebegin', lknIntegrationRedeForWoocommerceProFields(adminPage))
39 | }
40 | }
41 |
42 | wcForm.append(noticeDiv)
43 | }
44 |
45 | function lknFindGetParameter(parameterName) {
46 | let result = null
47 | let tmp = []
48 | location.search
49 | .substr(1)
50 | .split('&')
51 | .forEach(function (item) {
52 | tmp = item.split('=')
53 | if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1])
54 | })
55 | return result
56 | }
57 |
58 | // Código para deixar o campo de soft descriptor desabilitado caso o campo de habilitar esteja desmarcado
59 | const enabledSoftDescriptorInput = document.querySelector(`#woocommerce_${adminPage}_enabled_soft_descriptor`)
60 | const softDescriptorInput = document.querySelector(`#woocommerce_${adminPage}_soft_descriptor`)
61 |
62 | if (enabledSoftDescriptorInput && softDescriptorInput) {
63 | if (document.querySelector('#lknIntegrationRedeForWoocommerceSoftDescriptorErrorDiv') && enabledSoftDescriptorInput.checked) {
64 | const newP = document.createElement('p')
65 | newP.textContent = lknPhpVariables.descriptionError
66 | newP.style.color = 'FF0000'
67 |
68 | enabledSoftDescriptorInput.parentElement.appendChild(newP)
69 | }
70 |
71 | if (!enabledSoftDescriptorInput.checked) {
72 | softDescriptorInput.setAttribute('disabled', 'disabled')
73 | }
74 |
75 | enabledSoftDescriptorInput.addEventListener('change', function () {
76 | if (this.checked) {
77 | softDescriptorInput.removeAttribute('disabled')
78 | } else {
79 | softDescriptorInput.setAttribute('disabled', 'disabled')
80 | }
81 | })
82 | }
83 | })
84 | })(jQuery)
85 |
--------------------------------------------------------------------------------
/Admin/js/lkn-integration-rede-for-woocommerce-endpoint.js:
--------------------------------------------------------------------------------
1 | (function ($) {
2 | 'use strict'
3 |
4 | $(document).ready(function () {
5 | function handleEndpoint(endpointElement, baseUrl, listenerPath, settings) {
6 | if (endpointElement) {
7 | const url = baseUrl + listenerPath
8 |
9 | const pElement = document.createElement('p')
10 | pElement.textContent = url
11 |
12 | endpointElement.parentElement.appendChild(pElement)
13 | endpointElement.parentElement.id = 'integrationwoocommerceRedePixEndpointField'
14 |
15 | const span = document.createElement('span')
16 | const textElement = document.createElement('p')
17 |
18 | if (settings.endpointStatus) {
19 | span.classList.add('dashicons', 'dashicons-yes-alt')
20 | span.style.color = 'green'
21 | textElement.textContent = settings.translations.endpointSuccess
22 | } else {
23 | span.classList.add('dashicons', 'dashicons-dismiss')
24 | span.style.color = 'red'
25 | textElement.textContent = settings.translations.endpointError
26 | }
27 |
28 | textElement.style.paddingBottom = '2px'
29 | const div = document.createElement('div')
30 | div.appendChild(span)
31 | div.appendChild(textElement)
32 | div.id = 'integrationwoocommerceRedePixEndpointAlert'
33 |
34 | endpointElement.parentNode.appendChild(div)
35 |
36 | endpointElement.remove()
37 | }
38 | }
39 |
40 | const baseUrl = wpApiSettings.root
41 | const redeEndpointElement = document.querySelector('#woocommerce_integration_rede_pix_endpoint')
42 | const maxipagoDebitEndpointElement = document.querySelector('#woocommerce_maxipago_debit_endpoint')
43 |
44 | handleEndpoint(redeEndpointElement, baseUrl, 'redeIntegration/pixListener', lknRedeForWoocommerceProSettings)
45 | handleEndpoint(maxipagoDebitEndpointElement, baseUrl, 'redeIntegration/maxipagoDebitListener', lknRedeForWoocommerceProSettings)
46 | })
47 | })(jQuery)
48 |
--------------------------------------------------------------------------------
/Admin/js/lkn-integration-rede-for-woocommerce-pix-settings.js:
--------------------------------------------------------------------------------
1 | (function ($) {
2 | $(document).ready(function () {
3 | // Expiration count
4 | const $countInput = $('#woocommerce_integration_rede_pix_expiration_count')
5 |
6 | const countDefaultValue = 24
7 |
8 | $countInput.on('input', function () {
9 | if ($(this).val() !== countDefaultValue.toString()) {
10 | $(this).val(countDefaultValue)
11 | }
12 | })
13 |
14 | if ($countInput.length) {
15 | const $countFieldset = $countInput.closest('fieldset')
16 |
17 | $countFieldset.append('Disponível no PRO.
')
18 |
19 | $countFieldset.css({
20 | display: 'flex',
21 | 'flex-wrap': 'wrap',
22 | gap: '6px'
23 | })
24 | }
25 |
26 | // Select status
27 | const $selectInput = $('#woocommerce_integration_rede_pix_payment_complete_status')
28 |
29 | const selectDefaultValue = 'processing'
30 |
31 | $selectInput.on('change', function () {
32 | if ($(this).val() !== selectDefaultValue) {
33 | $(this).val(selectDefaultValue).trigger('change')
34 | }
35 | })
36 |
37 | if ($selectInput.length) {
38 | const $selectFieldset = $selectInput.closest('fieldset')
39 |
40 | $selectFieldset.append('Disponível no PRO.
')
41 |
42 | $selectFieldset.css({
43 | display: 'flex',
44 | 'flex-wrap': 'wrap',
45 | gap: '6px',
46 | width: '100% !important'
47 | })
48 | }
49 |
50 | $(document).ready(function () {
51 | function applyStyle() {
52 | $('.select2-container').css('width', 'fit-content')
53 | }
54 |
55 | const observer = new MutationObserver(function (mutationsList) {
56 | mutationsList.forEach(function () {
57 | applyStyle()
58 | })
59 | })
60 |
61 | observer.observe(document.body, { childList: true, subtree: true })
62 | })
63 | })
64 | })(jQuery)
65 |
--------------------------------------------------------------------------------
/Admin/js/lkn-integration-rede-for-woocommerce-plugin-rate.js:
--------------------------------------------------------------------------------
1 | (function ($) {
2 | $(document).ready(function () {
3 | const message = $('')
4 |
5 | message.html('Se você gosta do plugin Woo-rede, deixe-nos uma classificação de ★★★★★. Leva um minuto e nos ajuda muito. Obrigado antecipadamente!')
6 |
7 | message.css({
8 | 'text-align': 'center',
9 | padding: '10px',
10 | 'font-size': '13px',
11 | color: '#666'
12 | })
13 |
14 | $('#wpfooter').html(message).css('display', 'block')
15 |
16 | $('.give-rating-link').on('click', function (e) {
17 | $('#footer-left').html('Obrigado :)').css('text-align', 'center')
18 | })
19 | })
20 | })(jQuery)
21 |
--------------------------------------------------------------------------------
/Admin/js/lkn-integration-rede-for-woocommerce-settings-layout.js:
--------------------------------------------------------------------------------
1 | (function ($) {
2 | $(window).load(function () {
3 | // Selecionar os elementos
4 | let lknIntegrationRedeForWoocommerceSettingsLayoutMenuVar = 1
5 | const mainForm = document.querySelector('#mainform')
6 | const fistH1 = mainForm.querySelector('h1')
7 | const submitP = mainForm.querySelector('p.submit')
8 | const tables = mainForm.querySelectorAll('table')
9 |
10 | if (mainform && fistH1 && submitP && tables) {
11 | // Criar uma nova div
12 | const newDiv = document.createElement('div')
13 | newDiv.id = 'lknIntegrationRedeForWoocommerceSettingsLayoutDiv'
14 |
15 | // Acessar o próximo elemento após fistH1
16 | let currentElement = fistH1 // Começar com fistH1
17 |
18 | // Mover fistH1 e todos os elementos entre fistH1 e submitP para a nova div
19 | while (currentElement && currentElement !== submitP.nextElementSibling) {
20 | const nextElement = currentElement.nextElementSibling // Armazenar o próximo elemento antes de mover
21 | newDiv.appendChild(currentElement) // Mover o elemento atual para a nova div
22 | currentElement = nextElement // Atualizar currentElement para o próximo
23 | }
24 |
25 | // Mover submitP para a nova div
26 | newDiv.appendChild(submitP)
27 |
28 | // Adicionar a nova div ao mainForm
29 | mainForm.appendChild(newDiv)
30 |
31 | const subTitles = mainForm.querySelectorAll('.wc-settings-sub-title')
32 | const descriptionElement = mainForm.querySelector('p')
33 | const divElement = document.createElement('div')
34 | if (subTitles && descriptionElement) {
35 | // Criar a div que irá conter os novos elementos
36 | divElement.id = 'lknIntegrationRedeForWoocommerceSettingsLayoutMenu'
37 | aElements = []
38 | subTitles.forEach((subTitle, index) => {
39 | // Criar um novo elemento e adicionar o elemento a ele
40 | const aElement = document.createElement('a')
41 | aElement.textContent = subTitle.textContent
42 | aElement.href = '#'
43 | aElement.className = 'nav-tab'
44 | aElement.onclick = (event) => {
45 | lknIntegrationRedeForWoocommerceSettingsLayoutMenuVar = index + 1
46 | aElements.forEach((pElement, indexP) => {
47 | if (indexP == index) {
48 | aElements[index].className = 'nav-tab nav-tab-active'
49 | } else {
50 | aElements[indexP].className = 'nav-tab'
51 | }
52 | })
53 | changeLayout()
54 | }
55 |
56 | // Adicionar o novo elemento à div
57 | divElement.appendChild(aElement)
58 | aElements.push(aElement)
59 |
60 | // Remover o subtítulo original
61 | subTitle.parentNode.removeChild(subTitle)
62 | })
63 |
64 | aElements[0].className = 'nav-tab nav-tab-active'
65 |
66 | // Inserir a div após mainForm.querySelector('p')
67 | descriptionElement.parentNode.insertBefore(divElement, descriptionElement.nextSibling)
68 |
69 | tables.forEach((table, index) => {
70 | if (index != 0 && index != 1) {
71 | table.style.display = 'none'
72 | }
73 | table.menuIndex = index
74 | })
75 |
76 | function changeLayout() {
77 | tables.forEach((table, index) => {
78 | switch (lknIntegrationRedeForWoocommerceSettingsLayoutMenuVar) {
79 | case 1:
80 | if (index == 0 || index == 1) {
81 | table.style.display = 'flex'
82 | } else {
83 | table.style.display = 'none'
84 | }
85 | break
86 | case 2:
87 | if (index == 2) {
88 | table.style.display = 'flex'
89 | } else {
90 | table.style.display = 'none'
91 | }
92 | break
93 | case 3:
94 | if (index == 3) {
95 | table.style.display = 'flex'
96 | } else {
97 | table.style.display = 'none'
98 | }
99 | break
100 | case 4:
101 | if (index == 4) {
102 | table.style.display = 'flex'
103 | } else {
104 | table.style.display = 'none'
105 | }
106 | break
107 | }
108 | })
109 | }
110 |
111 | // Corrige bug de layout quando alguma mensagem é exibida
112 | const divToMove = document.getElementById('lknIntegrationRedeForWoocommerceSettingsLayoutMenu')
113 |
114 | if (divToMove) {
115 | const lknIntegrationRedeForWoocommerceSettingsLayoutDiv = document.getElementById('lknIntegrationRedeForWoocommerceSettingsLayoutDiv')
116 |
117 | if (lknIntegrationRedeForWoocommerceSettingsLayoutDiv) {
118 | const fifthElement = lknIntegrationRedeForWoocommerceSettingsLayoutDiv.children[3]
119 |
120 | if (fifthElement) {
121 | lknIntegrationRedeForWoocommerceSettingsLayoutDiv.insertBefore(divToMove, fifthElement.nextSibling)
122 | }
123 | }
124 | }
125 |
126 | // Caso o formulário tenha um campo inválido, força o click no menu em que o campo inválido está
127 | mainForm.addEventListener('invalid', function (event) {
128 | const invalidField = event.target
129 | if (invalidField) {
130 | let parentNode = invalidField.parentNode
131 | while (parentNode && parentNode.tagName !== 'TABLE') {
132 | parentNode = parentNode.parentNode
133 | }
134 | if (parentNode) {
135 | // Força o click no menu em que o campo inválido está
136 | // TODO Fix this latter pElements don't exist
137 | // if (pElements) {
138 | // pElements[parentNode.menuIndex - 1].parentNode.click()
139 | // }
140 | }
141 | }
142 | }, true)
143 | }
144 |
145 | const hrElement = document.createElement('hr')
146 | divElement.parentElement.insertBefore(hrElement, divElement.nextSibling)
147 | }
148 | })
149 | })(jQuery)
150 |
--------------------------------------------------------------------------------
/Admin/partials/lkn-integration-rede-for-woocommerce-admin-display.php:
--------------------------------------------------------------------------------
1 |
15 |
16 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 3.9.2 - 06/06/2025
2 | * Correção na URL de verificação do PIX.
3 |
4 | # 3.9.1 - 02/06/2025
5 | * Correção em limite de parcelas por produto.
6 | * Correção em exibição de logs no pedido.
7 |
8 | # 3.9.0 - 15/05/2025
9 | * Adição de compatibilidade com configuração PRO para adicionar desconto na parcela.
10 | * Adição de compatibilidade com configuração PRO para definir o valor mínimo para parcelas sem juros.
11 |
12 | # 3.8.0 - 08/05/2025
13 | - Adição de configuração para exibir logs dentro dos pedidos.
14 | - Correção em lógica do valor de parcela minima.
15 |
16 | # 3.7.5 - 07/05/2025
17 | - Correção em pagamento de débito com Maxipago.
18 |
19 | # 3.7.4 - 06/05/2025
20 | - Correção no reembolso de pagamento.
21 | - Correção no action de lançamento de plugin.
22 |
23 | # 3.7.3 - 06/05/2025
24 | - Correção no reembolso de pagamento.
25 |
26 | # 3.7.2 - 08/04/2025
27 | - Atualização de "Tested up to" para a versão mais recente do WordPress.
28 |
29 | # 3.7.1 - 18/03/2025
30 | - Correção em requisição de débito com Maxipago.
31 |
32 | # 3.7.0 - 11/03/2025
33 | - Adição de validação 3DS para pagamentos de débito com Maxipago;
34 | - Adição de endpoint para receber notificações no método de débito com Maxipago.
35 |
36 | # 3.6.4 - 27/02/2025
37 | - Correção campos do MaxiPago;
38 | - Correção de reconhecimento do retorno MaxiPAgo;
39 | - Adição de conversão do valor total da compra.
40 |
41 | # 3.6.3 - 24/02/2025
42 | - Correção configurações quando o plugin PRO está desativado.
43 |
44 | # 3.6.2 - 03/02/2025
45 | - Correção em validação do campo de CVV.
46 |
47 | # 3.6.1 - 24/01/2025
48 | - Correção de configuração.
49 |
50 | # 3.6.0 - 24/01/2025
51 | - Novo modo de pagamento via pix(rede).
52 | - Adição do notice de donwloado do plugin: fraud-detection-for-woocommerce.
53 | - Adição de mensagem de avaliação do plugin no footer.
54 |
55 | # 3.5.3 - 14/01/2025
56 | - Correção de valor total do pedido quando exitem taxas de entrega.
57 |
58 | # 3.5.2 - 18/12/2024
59 | - Correção de erro fatal em chamada de função de tradução.
60 |
61 | # 3.5.1 - 13/12/2024
62 | - Correção de segurança no CVV do cartão(Debito e crédito).
63 |
64 | # 3.5.0 - 05/12/2024
65 | - Atualização em versão do SDK;
66 | - Adição de cartão animado no checkout do editor de blocos WooCommerce.
67 |
68 | # 3.4.3 - 11/11/2024
69 | - Correção de avisos de atributos indefinidos;
70 | - Correção de declaração de compatibilidade para editor de blocos WooCommerce;
71 | - Melhoria de tratamento de varáveis de pagamento.
72 |
73 | # 3.4.2 - 08/11/2024
74 | - Alteração em layout das configurações do administrador.
75 |
76 | # 3.4.1 - 24/10/2024
77 | - Alteração em lógica de script de notificações.
78 |
79 | # 3.4.0 - 18/10/2024
80 | - Correção de erros de compatibilidade com editor por blocos do woocommerce;
81 | - Alteração em textos de hospedagem gratuita;
82 | - Alteração em layout das configurações do administrador;
83 | - Adição de configuração para desabilitar o campo de softdescriptor;
84 | - Adição da informação de bandeira do cartão nas informações do pedido.
85 |
86 | # 3.3.2 - 01/10/2024
87 | - Correção em campo de CPF do plugin de campos brasileiros.
88 |
89 | # 3.3.1 - 25/09/2024
90 | - Correção em exibição de parcelas;
91 |
92 | # 3.3.0 - 03/09/2024
93 | - Adição de compatibilidade com novas configurações do plugin PRO;
94 | - Adição de configuração para alterar status dos pedidos pagos.
95 |
96 | # 3.2.0 - 06/08/2024
97 | - Adição de configurações do Rede PRO como apenas leitura;
98 | - Adição de configuração para carregar o script de correção de carregamento infinito.
99 |
100 | # 3.1.3 - 30/07/2024
101 | - Melhoria no carregamento de scripts;
102 | - Correção de validação de campos gerando novos pedidos.
103 |
104 | # 3.1.2 - 23/07/2024
105 | * Correção de traduções não reconhecidas;
106 | * Correção de geração de pedidos inválidos;
107 | * Ajustes na validação de campos;
108 | * Otimização de código.
109 |
110 | # 3.1.1 - 22/07/2024
111 | * Correção em scripts da animação do cartão.
112 |
113 | # 3.1.0 - 16/07/2024
114 | * Adição de compatibilidade com o plugin PRO.
115 | * Adicionada opção de compatibilidade para carregar CSS legado.
116 | * Adicionado botão facilitado para ver logs da transação;
117 | * Correção de bug de issuer;
118 | * Correção de bug de reembolso;
119 | * Correção de bug de transação não sendo capturada de forma automática;
120 | * Correção de bug de renderização de campos na página de finalização de compra;
121 |
122 | # 3.0.5 - 29/05/2024
123 | * Correção de função para fazer o reembolso de pedidos.
124 |
125 | # 3.0.4 - 24/05/2024
126 | * Correção de looping para criar animação de cartão.
127 |
128 | # 3.0.3 - 23/05/2024
129 | * Correção de erros em função para salvar o total da compra.
130 |
131 | # 3.0.2 - 22/05/2024
132 | * Correção de erros de layout de método de pagamento no checkout.
133 |
134 | # 3.0.1 - 21/05/2024
135 | * Correção de erros no método de pagamento no checkout.
136 |
137 | # 3.0.0 - 09/05/2024
138 | * Refatoração completa do plugin para arquitetura orientada a objetos;
139 | * Adição da opção de débito para pagamentos com Rede;
140 | * Adição de Maxipago para métodos de pagamento.
141 |
142 | # 2.1.0 - 05/12/2020
143 | * Atualização das informações de compatibilidade;
144 | * Correção do ID do pedido;
145 | * Implementação de filtro de parcelamento;
146 | * Implementação de um filtro para exibir os dados da Rede na página do pedido apenas se este for o método de pagamento utilizado;
147 | * Melhorias no layout do cartão na página de checkout.
148 |
149 | # 2.0.2 - 23/05/2020
150 | * Atualização das informações de compatibilidade;
151 | * Correção do ID do pedido.
152 |
153 | # 2.0.1 - 04/05/2020
154 | * Atualização das informações de compatibilidade;
155 | * Correção da internacionalização das mensagens de erro na página de checkout.
156 |
157 | # 2.0.0 - 02/11/2019
158 | * Correção da exibição do número de parcelas;
159 | * Ajuste do placeholder do ano na expiração do cartão;
160 | * Internacionalização e tradução do plugin para pt_BR;
161 | * Inclusão de ícones de bandeiras de cartões de crédito;
162 | * A data de expiração agora aceita 2 ou 4 dígitos para o ano;
163 | * Sanitização dos campos de entrada.
164 |
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceActivator.php:
--------------------------------------------------------------------------------
1 |
23 | */
24 | final class LknIntegrationRedeForWoocommerceActivator {
25 | /**
26 | * Short Description. (use period)
27 | *
28 | * Long Description.
29 | *
30 | * @since 1.0.0
31 | */
32 | public static function activate(): void {
33 | if ( ! wp_next_scheduled( 'update_rede_orders' ) ) {
34 | wp_schedule_event( time(), 'hourly', 'update_rede_orders' );
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceDeactivator.php:
--------------------------------------------------------------------------------
1 |
23 | */
24 | final class LknIntegrationRedeForWoocommerceDeactivator {
25 | /**
26 | * Short Description. (use period)
27 | *
28 | * Long Description.
29 | *
30 | * @since 1.0.0
31 | */
32 | public static function deactivate(): void {
33 | wp_clear_scheduled_hook( 'update_rede_orders' );
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceHelper.php:
--------------------------------------------------------------------------------
1 | cart) {
15 | return (float) $woocommerce->cart->total;
16 | }
17 | return 0;
18 | }
19 |
20 | final public static function updateFixLoadScriptOption($id): void
21 | {
22 | $wpnonce = isset($_POST['_wpnonce']) ? sanitize_text_field(wp_unslash($_POST['_wpnonce'])) : '';
23 | $section = isset($_GET['section']) ? sanitize_text_field(wp_unslash($_GET['section'])) : '';
24 |
25 | if (! empty($wpnonce) && $section === $id) {
26 | $enabledFixLoadScript = isset($_POST["woocommerce_" . $id . "_enabled_fix_load_script"]) ? 'yes' : 'no';
27 |
28 | $optionsToUpdate = array(
29 | 'maxipago_credit',
30 | 'maxipago_debit',
31 | 'rede_credit',
32 | 'rede_debit',
33 | );
34 |
35 | foreach ($optionsToUpdate as $option) {
36 | $paymentOptions = get_option('woocommerce_' . $option . '_settings', array());
37 | $paymentOptions['enabled_fix_load_script'] = $enabledFixLoadScript;
38 | update_option('woocommerce_' . $option . '_settings', $paymentOptions);
39 | }
40 | }
41 | }
42 |
43 | final public static function getCardBrand($tid, $instace)
44 | {
45 | $auth = base64_encode($instace->pv . ':' . $instace->token);
46 |
47 | if ('production' === $instace->environment) {
48 | $apiUrl = 'https://api.userede.com.br/erede/v1/transactions';
49 | } else {
50 | $apiUrl = 'https://sandbox-erede.useredecloud.com.br/v1/transactions';
51 | }
52 |
53 | $response = wp_remote_get($apiUrl . '/' . $tid, array(
54 | 'headers' => array(
55 | 'Authorization' => 'Basic ' . $auth,
56 | 'Content-Type' => 'application/json',
57 | 'Transaction-Response' => 'brand-return-opened'
58 | ),
59 | ));
60 |
61 | $response_body = wp_remote_retrieve_body($response);
62 | $response_body = json_decode($response_body, true);
63 |
64 | return($response_body['authorization']['brand']['name']);
65 | }
66 |
67 | final public static function censorString($string, $censorLength) {
68 | $length = strlen($string);
69 |
70 | if ($censorLength >= $length) {
71 | // Se o número de caracteres a censurar for maior ou igual ao comprimento total, censura tudo
72 | return str_repeat('*', $length);
73 | }
74 |
75 | $startLength = floor(($length - $censorLength) / 2); // Dividir o restante igualmente entre início e fim
76 | $endLength = $length - $startLength - $censorLength; // O que sobra para o final
77 |
78 | $start = substr($string, 0, $startLength);
79 | $end = substr($string, -$endLength);
80 |
81 | $censored = str_repeat('*', $censorLength);
82 | return $start . $censored . $end;
83 | }
84 |
85 | public function showOrderLogs(): void {
86 | $id = isset($_GET['id']) ? sanitize_text_field(wp_unslash($_GET['id'])) : '';
87 | if (empty($id)) {
88 | $id = isset($_GET['post']) ? sanitize_text_field(wp_unslash($_GET['post'])) : '';
89 | }
90 | if ( ! empty($id)) {
91 | $order_id = $id;
92 | $order = wc_get_order( $order_id );
93 |
94 | if ($order && $order instanceof WC_Order) {
95 | $orderLogs = $order->get_meta('lknWcRedeOrderLogs');
96 | $payment_method_id = $order->get_payment_method();
97 | $options = get_option('woocommerce_' . $payment_method_id . '_settings');
98 | if ($orderLogs && 'yes' === $options['show_order_logs']) {
99 | $screen = class_exists( '\Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController' ) && wc_get_container()->get( 'Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController' )->custom_orders_table_usage_is_enabled()
100 | ? wc_get_page_screen_id( 'shop-order' )
101 | : 'shop_order';
102 |
103 | add_meta_box(
104 | 'showOrderLogs',
105 | 'Logs das transações',
106 | array($this, 'showLogsContent'),
107 | $screen,
108 | 'advanced',
109 | );
110 | }
111 | }
112 | }
113 | }
114 |
115 | public function showLogsContent($object): void
116 | {
117 | // Obter o objeto WC_Order
118 | $order = is_a($object, 'WP_Post') ? wc_get_order($object->ID) : $object;
119 | $orderLogs = $order->get_meta('lknWcRedeOrderLogs');
120 |
121 | // Decodificar o JSON armazenado
122 | $decodedLogs = json_decode($orderLogs, true);
123 |
124 | if ($decodedLogs && is_array($decodedLogs)) {
125 | // Preparar cada seção para exibição com formatação
126 | $url = $decodedLogs['url'] ?? 'N/A';
127 | $body = isset($decodedLogs['body']) ? json_encode($decodedLogs['body'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) : 'N/A';
128 | $response = isset($decodedLogs['response']) ? json_encode($decodedLogs['response'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) : 'N/A';
129 |
130 | // Exibir as seções formatadas
131 | ?>
132 |
133 |
137 |
138 |
Body:
139 |
140 |
141 |
Response:
142 |
143 |
144 |
24 | */
25 | final class LknIntegrationRedeForWoocommerceLoader {
26 | /**
27 | * The array of actions registered with WordPress.
28 | *
29 | * @since 1.0.0
30 | * @access protected
31 | * @var array $actions The actions registered with WordPress to fire when the plugin loads.
32 | */
33 | protected $actions;
34 |
35 | /**
36 | * The array of filters registered with WordPress.
37 | *
38 | * @since 1.0.0
39 | * @access protected
40 | * @var array $filters The filters registered with WordPress to fire when the plugin loads.
41 | */
42 | protected $filters;
43 |
44 | /**
45 | * Initialize the collections used to maintain the actions and filters.
46 | *
47 | * @since 1.0.0
48 | */
49 | public function __construct() {
50 | $this->actions = array();
51 | $this->filters = array();
52 | }
53 |
54 | /**
55 | * Add a new action to the collection to be registered with WordPress.
56 | *
57 | * @since 1.0.0
58 | * @param string $hook The name of the WordPress action that is being registered.
59 | * @param object $component A reference to the instance of the object on which the action is defined.
60 | * @param string $callback The name of the function definition on the $component.
61 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
62 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
63 | */
64 | public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1): void {
65 | $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args);
66 | }
67 |
68 | /**
69 | * Add a new filter to the collection to be registered with WordPress.
70 | *
71 | * @since 1.0.0
72 | * @param string $hook The name of the WordPress filter that is being registered.
73 | * @param object $component A reference to the instance of the object on which the filter is defined.
74 | * @param string $callback The name of the function definition on the $component.
75 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
76 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
77 | */
78 | public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1): void {
79 | $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args);
80 | }
81 |
82 | /**
83 | * A utility function that is used to register the actions and hooks into a single
84 | * collection.
85 | *
86 | * @since 1.0.0
87 | * @access private
88 | * @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
89 | * @param string $hook The name of the WordPress filter that is being registered.
90 | * @param object $component A reference to the instance of the object on which the filter is defined.
91 | * @param string $callback The name of the function definition on the $component.
92 | * @param int $priority The priority at which the function should be fired.
93 | * @param int $accepted_args The number of arguments that should be passed to the $callback.
94 | * @return array The collection of actions and filters registered with WordPress.
95 | */
96 | private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) {
97 | $hooks[] = array(
98 | 'hook' => $hook,
99 | 'component' => $component,
100 | 'callback' => $callback,
101 | 'priority' => $priority,
102 | 'accepted_args' => $accepted_args
103 | );
104 |
105 | return $hooks;
106 | }
107 |
108 | /**
109 | * Register the filters and actions with WordPress.
110 | *
111 | * @since 1.0.0
112 | */
113 | public function run(): void {
114 | foreach ($this->filters as $hook) {
115 | add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']);
116 | }
117 |
118 | foreach ($this->actions as $hook) {
119 | add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']);
120 | }
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceWcEndpoint.php:
--------------------------------------------------------------------------------
1 | 'POST',
14 | 'callback' => array($this, 'pixListener'),
15 | 'permission_callback' => '__return_true',
16 | ));
17 |
18 | register_rest_route('redeIntegration', '/verifyPixRedeStatus', array(
19 | 'methods' => 'GET',
20 | 'callback' => array($this, 'verifyPixRedeStatus'),
21 | 'permission_callback' => '__return_true',
22 | ));
23 |
24 | register_rest_route('redeIntegration', '/maxipagoDebitListener', array(
25 | 'methods' => 'POST',
26 | 'callback' => array($this, 'maxipagoDebitListener'),
27 | 'permission_callback' => '__return_true',
28 | ));
29 |
30 | register_rest_route('redeIntegration', '/clearOrderLogs', array(
31 | 'methods' => 'DELETE',
32 | 'callback' => array($this, 'clearOrderLogs'),
33 | 'permission_callback' => '__return_true',
34 | ));
35 | }
36 |
37 | public function clearOrderLogs($request) {
38 | $args = array(
39 | 'limit' => -1, // Sem limite, pega todas as ordens
40 | 'meta_key' => 'lknWcRedeOrderLogs', // Meta key específica
41 | 'meta_compare' => 'EXISTS', // Verifica se a meta key existe
42 | );
43 |
44 | $orders = wc_get_orders($args);
45 |
46 | foreach ($orders as $order) {
47 | $order->delete_meta_data('lknWcRedeOrderLogs');
48 | $order->save();
49 | }
50 |
51 | return new WP_REST_Response($orders, 200);
52 | }
53 |
54 | public function maxipagoDebitListener($request) {
55 | add_option('LknIntegrationRedeForWoocommerceMaxipagoDebitEndpointStatus', true);
56 | update_option('LknIntegrationRedeForWoocommerceMaxipagoDebitEndpointStatus', true);
57 | $requestBody = $request->get_body();
58 |
59 | parse_str($requestBody, $parsedBody);
60 | $xmlString = urldecode($parsedBody['xml']);
61 | $xmlObject = simplexml_load_string($xmlString, "SimpleXMLElement", LIBXML_NOCDATA);
62 | $notification = $xmlObject->{'transaction-event'};
63 |
64 | // Converte o valor de orderID para string
65 | $referenceNumber = (string) $notification->referenceNumber;
66 | $transactionStatus = (string) $notification->transactionStatus;
67 | $maxipagoPixOptions = get_option('woocommerce_maxipago_debit_settings');
68 |
69 | $args = array(
70 | 'limit' => -1,
71 | 'status' => array_keys( wc_get_order_statuses() ),
72 | 'meta_key' => '_wc_maxipago_transaction_reference_num',
73 | 'meta_value' => $referenceNumber,
74 | );
75 | $order = wc_get_orders( $args )[0];
76 |
77 | switch ($transactionStatus) {
78 | case '3':
79 | $paymentCompleteStatus = $maxipagoPixOptions['payment_complete_status'];
80 | if ("" == $paymentCompleteStatus) {
81 | $paymentCompleteStatus = 'processing';
82 | }
83 | $order->update_status($paymentCompleteStatus);
84 | break;
85 | case '9':
86 | $order->update_status('cancelled');
87 | break;
88 | default:
89 | $order->update_status('cancelled');
90 | break;
91 | }
92 |
93 | return new WP_REST_Response('', 200);
94 | }
95 |
96 | public function pixListener($request)
97 | {
98 | add_option('LknIntegrationRedeForWoocommerceEndpointStatus', true);
99 | update_option('LknIntegrationRedeForWoocommerceEndpointStatus', true);
100 | $requestParams = $request->get_params();
101 |
102 | $redePixOptions = get_option('woocommerce_integration_rede_pix_settings');
103 | $tid = $requestParams['data']['id'];
104 |
105 | // Argumentos para buscar todos os pedidos
106 | $args = array(
107 | 'limit' => -1,
108 | 'status' => array_keys(wc_get_order_statuses()),
109 | 'meta_key' => '_wc_rede_integration_pix_transaction_tid',
110 | 'meta_value' => $tid,
111 | );
112 |
113 | // Usa wc_get_orders para buscar os pedidos
114 | $order = wc_get_orders($args)[0];
115 |
116 | if (! empty($order)) {
117 | if ('PV.UPDATE_TRANSACTION_PIX' == $requestParams['events'][0]) {
118 | $paymentCompleteStatus = $redePixOptions['payment_complete_status'];
119 | if ("" == $paymentCompleteStatus) {
120 | $paymentCompleteStatus = 'processing';
121 | }
122 | $order->update_status($paymentCompleteStatus);
123 | }
124 | }
125 |
126 | return new WP_REST_Response('', 200);
127 | }
128 |
129 | public function verifyPixRedeStatus($request)
130 | {
131 | $parameters = $request->get_params();
132 | $order = wc_get_order($parameters['donationId']);
133 | $tId = $order->get_meta('_wc_rede_integration_pix_transaction_tid');
134 | if (empty($order)) {
135 | return new WP_Error('order_not_found', __('Order not found', 'woo-rede'), array('status' => 404));
136 | }
137 |
138 | $pixOptions = get_option('woocommerce_integration_rede_pix_settings');
139 | $pv = sanitize_text_field($pixOptions['pv']);
140 | $token = sanitize_text_field($pixOptions['token']);
141 | $auth = base64_encode($pv . ':' . $token);
142 | $environment = $pixOptions['environment'];
143 |
144 | if ('production' === $environment) {
145 | $apiUrl = 'https://api.userede.com.br/erede/v1/transactions/';
146 | } else {
147 | $apiUrl = 'https://sandbox-erede.useredecloud.com.br/v1/transactions/';
148 | }
149 | $response = wp_remote_post($apiUrl . $tId, array(
150 | 'method' => 'GET',
151 | 'headers' => array(
152 | 'Content-Type' => 'application/json',
153 | 'Authorization' => 'Basic ' . $auth
154 | ),
155 | ));
156 | $response_body = wp_remote_retrieve_body($response);
157 | $response_body = json_decode($response_body, true);
158 |
159 | if (($response_body['authorization']['status'] ?? 'Accepted') == 'Approved') {
160 | $paymentCompleteStatus = $pixOptions['payment_complete_status'];
161 | if ("" == $paymentCompleteStatus) {
162 | $paymentCompleteStatus = 'processing';
163 | }
164 | $order->update_status($paymentCompleteStatus);
165 |
166 | $order->save();
167 | }
168 |
169 | return new WP_REST_Response($response_body['authorization']['status'] ?? 'Accepted', 200);
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceWcMaxipagoCreditBlocks.php:
--------------------------------------------------------------------------------
1 | settings = get_option('woocommerce_maxipago_credit_settings', array());
16 | $this->gateway = new LknIntegrationRedeForWoocommerceWcMaxipagoCredit();
17 | }
18 |
19 | public function is_active()
20 | {
21 | return $this->gateway->is_available();
22 | }
23 |
24 | public function get_payment_method_script_handles()
25 | {
26 | wp_enqueue_style('select-style', plugin_dir_url(INTEGRATION_REDE_FOR_WOOCOMMERCE_FILE) . '/Public/css/lknIntegrationRedeForWoocommerceSelectStyle.css', array(), '1.0.0', 'all');
27 | wp_register_script(
28 | 'maxipago_credit-blocks-integration',
29 | plugin_dir_url(__FILE__) . '../Public/js/creditCard/maxipago/lknIntegrationMaxipagoForWoocommerceCheckoutCompiled.js',
30 | array(
31 | 'wc-blocks-registry',
32 | 'wc-settings',
33 | 'wp-element',
34 | 'wp-html-entities',
35 | 'wp-i18n',
36 | ),
37 | '1.0.0',
38 | true
39 | );
40 | if (function_exists('wp_set_script_translations')) {
41 | wp_set_script_translations('maxipago_credit-blocks-integration');
42 | }
43 |
44 | apply_filters('integrationRedeSetCustomCSSPro', get_option('woocommerce_maxipago_credit_settings')['custom_css_block_editor'] ?? false);
45 |
46 | return array('maxipago_credit-blocks-integration');
47 | }
48 |
49 | public function get_payment_method_data()
50 | {
51 | $cart_total = LknIntegrationRedeForWoocommerceHelper::getCartTotal();
52 | $settings = get_option('woocommerce_maxipago_credit_settings');
53 | $maxParcels = $settings['max_parcels_number'];
54 | $minParcelValue = (float) $settings['min_parcels_value'];
55 |
56 | $phpArray = array(
57 | 'title' => $this->gateway->title,
58 | 'description' => $this->gateway->description,
59 | 'nonceMaxipagoCredit' => wp_create_nonce('maxipagoCardNonce'),
60 | 'minInstallmentsMaxipago' => get_option('woocommerce_maxipago_credit_settings')['min_parcels_value'],
61 | 'maxInstallmentsMaxipago' => $maxParcels,
62 | 'cartTotal' => $cart_total,
63 | 'translations' => array(
64 | 'fieldsNotFilled' => __('Please fill in all fields correctly.', 'woo-rede'),
65 | 'cardNumber' => __('Card Number', 'woo-rede'),
66 | 'cardExpiringDate' => __('Card Expiring Date', 'woo-rede'),
67 | 'securityCode' => __('Security Code', 'woo-rede'),
68 | 'nameOnCard' => __('Name on Card', 'woo-rede'),
69 | 'installments' => __('Installments', 'woo-rede'),
70 | 'district' => __('District', 'woo-rede'),
71 | 'interestFree' => ' ' . __('interest-free', 'woo-rede'),
72 | )
73 | );
74 |
75 | if (
76 | isset($settings['installment_interest']) &&
77 | ($settings['installment_interest'] === 'yes' || $settings['installment_discount']) &&
78 | is_plugin_active('rede-for-woocommerce-pro/rede-for-woocommerce-pro.php')
79 | ) {
80 |
81 | for ($i = 1; $i <= $maxParcels; ++$i) {
82 | $parcelAmount = $cart_total / $i;
83 | if ($parcelAmount >= $minParcelValue) {
84 | $interest = round((float) $settings[$i . 'x'], 2);
85 | $customLabel = apply_filters('integrationRedeGetInterest', $cart_total, $interest, $i, 'label', $this->gateway);
86 |
87 | if($customLabel){
88 | $phpArray[$i . 'x'] = $customLabel;
89 | }
90 | }
91 | }
92 | } else {
93 | for ($i = 1; $i <= $maxParcels; ++$i) {
94 | $parcelAmount = $cart_total / $i;
95 | if ($parcelAmount >= $minParcelValue) {
96 | $phpArray[$i . 'x'] = html_entity_decode(sprintf('%dx de %s', $i, wp_strip_all_tags(wc_price($parcelAmount))));
97 | }
98 | }
99 | }
100 | return $phpArray;
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceWcMaxipagoDebitBlocks.php:
--------------------------------------------------------------------------------
1 | settings = get_option( 'woocommerce_maxipago_debit_settings', array() );
13 | $this->gateway = new LknIntegrationRedeForWoocommerceWcMaxipagoDebit();
14 | }
15 |
16 | public function is_active() {
17 | return $this->gateway->is_available();
18 | }
19 |
20 | public function get_payment_method_script_handles() {
21 | wp_register_script(
22 | 'maxipago_debit-blocks-integration',
23 | plugin_dir_url( __FILE__ ) . '../Public/js/debitCard/maxipago/lknIntegrationMaxipagoForWoocommerceCheckoutCompiled.js',
24 | array(
25 | 'wc-blocks-registry',
26 | 'wc-settings',
27 | 'wp-element',
28 | 'wp-html-entities',
29 | 'wp-i18n',
30 | ),
31 | '1.0.0',
32 | true
33 | );
34 | if ( function_exists( 'wp_set_script_translations' ) ) {
35 | wp_set_script_translations( 'maxipago_debit-blocks-integration');
36 | }
37 |
38 | apply_filters('integrationRedeSetCustomCSSPro', get_option('woocommerce_maxipago_debit_settings')['custom_css_block_editor'] ?? false);
39 |
40 | return array('maxipago_debit-blocks-integration');
41 | }
42 |
43 | public function get_payment_method_data() {
44 | $cart_total = LknIntegrationRedeForWoocommerceHelper::getCartTotal();
45 |
46 | return array(
47 | 'title' => $this->gateway->title,
48 | 'description' => $this->gateway->description,
49 | 'nonceMaxipagoDebit' => wp_create_nonce( 'maxipago_debit_nonce' ),
50 | 'cartTotal' => $cart_total,
51 | 'translations' => array(
52 | 'fieldsNotFilled' => __('Please fill in all fields correctly.', 'woo-rede'),
53 | 'cardNumber' => __('Card Number', 'woo-rede'),
54 | 'cardExpiringDate' => __( 'Card Expiring Date', 'woo-rede' ),
55 | 'securityCode' => __('Security Code', 'woo-rede' ),
56 | 'nameOnCard' => __( 'Name on Card', 'woo-rede' ),
57 | 'district' => __('District', 'woo-rede'),
58 | )
59 | );
60 | }
61 | }
62 | ?>
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceWcPixHelper.php:
--------------------------------------------------------------------------------
1 | get_option('pv'));
12 | $total = str_replace(".", "", $total);
13 | $token = sanitize_text_field($pixInstance->get_option('token'));
14 | $auth = base64_encode($pv . ':' . $token);
15 | $environment = $pixInstance->get_option('environment');
16 | $expirationCountOption = $pixInstance->get_option('expiration_count');
17 | $expirationCount = empty($expirationCountOption) ? 1 : $expirationCountOption;
18 | $date = new DateTime();
19 | $date->modify('+' . $expirationCount . ' hours');
20 | $dateTimeExpiration = $date->format('Y-m-d\TH:i:s');
21 | $order->update_meta_data('_wc_rede_pix_integration_time_expiration', $dateTimeExpiration);
22 | if ('production' === $environment) {
23 | $apiUrl = 'https://api.userede.com.br/erede/v1/transactions';
24 | } else {
25 | $apiUrl = 'https://sandbox-erede.useredecloud.com.br/v1/transactions';
26 | }
27 |
28 | $body = array(
29 | 'kind' => 'pix',
30 | 'reference' => $reference,
31 | 'amount' => $total,
32 | 'qrCode' => array(
33 | 'dateTimeExpiration' => $dateTimeExpiration
34 | )
35 | );
36 |
37 | $response = wp_remote_post($apiUrl, array(
38 | 'method' => 'POST',
39 | 'headers' => array(
40 | 'Content-Type' => 'application/json',
41 | 'Authorization' => 'Basic ' . $auth
42 | ),
43 | 'body' => wp_json_encode($body),
44 | ));
45 |
46 | $response_body = wp_remote_retrieve_body($response);
47 | $response_body = json_decode($response_body, true);
48 |
49 | if ($pixInstance->get_option('debug') == 'yes') {
50 | $orderLogsArray = array(
51 | 'url' => $apiUrl,
52 | 'body' => $body,
53 | 'response' => $response_body
54 | );
55 |
56 | $orderLogs = json_encode($orderLogsArray);
57 | $order->update_meta_data('lknWcRedeOrderLogs', $orderLogs);
58 | }
59 | return $response_body;
60 | }
61 |
62 | public static function refundPixRede($total, $pixInstance, $orderId)
63 | {
64 | $pv = sanitize_text_field($pixInstance->get_option('pv'));
65 | $token = sanitize_text_field($pixInstance->get_option('token'));
66 | $auth = base64_encode($pv . ':' . $token);
67 | $total = str_replace(".", "", $total);
68 | $environment = $pixInstance->get_option('environment');
69 | $order = wc_get_order($orderId);
70 | $tid = $order->get_meta('_wc_rede_integration_pix_transaction_tid');
71 | if ('production' === $environment) {
72 | $apiUrl = 'https://api.userede.com.br/erede/v1/transactions';
73 | } else {
74 | $apiUrl = 'https://sandbox-erede.useredecloud.com.br/v1/transactions';
75 | }
76 |
77 | $body = array(
78 | 'amount' => $total,
79 | );
80 |
81 | $response = wp_remote_post($apiUrl . '/' . $tid . '/refunds', array(
82 | 'method' => 'POST',
83 | 'headers' => array(
84 | 'Content-Type' => 'application/json',
85 | 'Authorization' => 'Basic ' . $auth
86 | ),
87 | 'body' => wp_json_encode($body),
88 | ));
89 |
90 | $response_body = wp_remote_retrieve_body($response);
91 | $response_body = json_decode($response_body, true);
92 |
93 | return $response_body;
94 | }
95 |
96 | public static function generateMetaTable($order, $metaKeys, $title): void
97 | {
98 | require INTEGRATION_REDE_FOR_WOOCOMMERCE_DIR . 'Includes/views/LknIntegrationRedeForWoocommerceMetaTable.php';
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceWcPixRedeBlocks.php:
--------------------------------------------------------------------------------
1 | settings = get_option('woocommerce_integration_rede_pix_settings', array());
15 | $this->gateway = new LknIntegrationRedeForWoocommerceWcPixRede();
16 | }
17 |
18 | public function is_active()
19 | {
20 | return $this->gateway->is_available();
21 | }
22 |
23 | public function get_payment_method_script_handles()
24 | {
25 | wp_enqueue_style('integration-rede-pix-style-blocks', INTEGRATION_REDE_FOR_WOOCOMMERCE_DIR_URL . 'Public/css/rede/LknIntegrationRedeForWoocommercePaymentFields.css', array(), '1.0.0', 'all');
26 | wp_register_script(
27 | 'rede-pix-blocks-integration',
28 | plugin_dir_url(__FILE__) . '../Public/js/pix/LknIntegrationRedeForWoocommercePixRede.js',
29 | array(
30 | 'wc-blocks-registry',
31 | 'wc-settings',
32 | 'wp-element',
33 | 'wp-html-entities',
34 | 'wp-i18n',
35 | ),
36 | '1.0.0',
37 | true
38 | );
39 | if (function_exists('wp_set_script_translations')) {
40 | wp_set_script_translations('rede-pix-blocks-integration');
41 | }
42 |
43 | return array('rede-pix-blocks-integration');
44 | }
45 |
46 | public function get_payment_method_data()
47 | {
48 | $option = get_option('woocommerce_integration_rede_pix_settings');
49 |
50 | return array(
51 | 'title' => $this->gateway->title,
52 | 'description' => $option['description'] ?? __('Pay for your purchase with a pix through ', 'woo-rede'),
53 | );
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceWcRede.php:
--------------------------------------------------------------------------------
1 | upgrade();
18 | }
19 |
20 | public function getInstance()
21 | {
22 | if (null == self::$instance) {
23 | self::$instance = new self();
24 | }
25 |
26 | return self::$instance;
27 | }
28 |
29 | public static function getTemplatesPath()
30 | {
31 | return plugin_dir_path(__FILE__) . 'templates/';
32 | }
33 |
34 | public function addGateway($methods)
35 | {
36 | $wc_rede_credit_class = new LknIntegrationRedeForWoocommerceWcRedeCredit();
37 | $wc_rede_debit_class = new LknIntegrationRedeForWoocommerceWcRedeDebit();
38 | $wc_rede_pix_class = new LknIntegrationRedeForWoocommerceWcPixRede();
39 | $wc_maxipago_credit_class = new LknIntegrationRedeForWoocommerceWcMaxipagoCredit();
40 | $wc_maxipago_debit_class = new LknIntegrationRedeForWoocommerceWcMaxipagoDebit();
41 |
42 | array_push($methods, $wc_rede_credit_class);
43 | array_push($methods, $wc_rede_debit_class);
44 | array_push($methods, $wc_rede_pix_class);
45 | array_push($methods, $wc_maxipago_credit_class);
46 | array_push($methods, $wc_maxipago_debit_class);
47 |
48 | return $methods;
49 | }
50 |
51 | private function upgrade(): void
52 | {
53 | if (is_admin()) {
54 | $version = get_option('wc_rede_version', '0');
55 |
56 | if (version_compare($version, self::VERSION, '<')) {
57 | if ($options = get_option('woocommerce_rede_settings')) {
58 | $credit_options = array(
59 | 'enabled' => $options['enabled'],
60 | 'title' => 'Ativar',
61 |
62 | 'environment' => $options['environment'],
63 | 'token' => $options['token'],
64 | 'pv' => $options['pv'],
65 |
66 | 'soft_descriptor' => $options['soft_descriptor'],
67 |
68 | 'min_parcels_value' => $options['smallest_installment'],
69 | 'max_parcels_number' => $options['installments'],
70 | );
71 |
72 | update_option('woocommerce_rede_credit_settings', $credit_options);
73 |
74 | delete_option('woocommerce_rede_settings');
75 | }
76 |
77 | update_option('wc_rede_version', self::VERSION);
78 | }
79 | }
80 | }
81 |
82 | public function woocommerceMissingNotice(): void
83 | {
84 | deactivate_plugins(plugin_basename(INTEGRATION_REDE_FOR_WOOCOMMERCE_FILE));
85 | include_once __DIR__ . '/views/notices/html-notice-woocommerce-missing.php';
86 | }
87 |
88 | public function softDescriptorNotice(): void
89 | {
90 | $errorCredit = get_option('lknIntegrationRedeForWoocommerceSoftDescriptorErrorCredit');
91 | $errorDebit = get_option('lknIntegrationRedeForWoocommerceSoftDescriptorErrorDebit');
92 | if ($errorCredit == true || $errorDebit == true) {
93 | $message = '
94 |
101 | ';
102 |
103 | echo wp_kses_post($message);
104 | }
105 | }
106 |
107 | public function updateRedeOrders(): void
108 | {
109 | $orders = new WP_Query(
110 | array(
111 | 'post_type' => 'shop_order',
112 | 'post_status' => array('wc-on-hold', 'wc-processing'),
113 | )
114 | );
115 |
116 | foreach ($orders->posts as $order) {
117 | $wc_order = new WC_Order($order->ID);
118 | $wc_id = $wc_order->get_id();
119 | $payment_gateway = wc_get_payment_gateway_by_order($wc_order);
120 | $order_id = get_post_meta($wc_id, '_wc_rede_order_id', true);
121 | $status = get_post_meta($wc_id, '_wc_rede_status', true);
122 | $tid = $tid = get_post_meta($wc_id, '_wc_rede_transaction_id', true);
123 |
124 | if ($payment_gateway instanceof LknIntegrationRedeForWoocommerceWcRedeAbstract) {
125 | if ('PENDING' == $status || 'SUBMITTED' == $status) {
126 | $payment_gateway->consult_order($wc_order, $order_id, $tid, $status);
127 | }
128 | }
129 | }
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceWcRedeAPI.php:
--------------------------------------------------------------------------------
1 | pv;
24 | $token = $gateway->token;
25 |
26 | if ('test' == $gateway->environment) {
27 | $environment = Environment::sandbox();
28 | } else {
29 | $environment = Environment::production();
30 | }
31 |
32 | $this->gateway = $gateway;
33 | $this->capture = (bool) $gateway->auto_capture;
34 | $this->soft_descriptor = $gateway->soft_descriptor;
35 | $this->partner_gateway = $gateway->partner_gateway;
36 | $this->partner_module = $gateway->partner_module;
37 | $this->store = new Store($pv, $token, $environment);
38 | }
39 |
40 | /**
41 | * @param $id
42 | * @param $amount
43 | * @param int $installments
44 | * @param array $credit_card_data
45 | * @return Transaction|StdClass
46 | */
47 | public function doTransactionCreditRequest(
48 | $id,
49 | $amount,
50 | $installments = 1,
51 | $credit_card_data = array()
52 | ) {
53 | $transaction = (new Transaction($amount, $id))->creditCard(
54 | $credit_card_data['card_number'],
55 | $credit_card_data['card_cvv'],
56 | $credit_card_data['card_expiration_month'],
57 | $credit_card_data['card_expiration_year'],
58 | $credit_card_data['card_holder']
59 | )->capture($this->capture);
60 |
61 | if ($installments > 1) {
62 | $transaction->setInstallments($installments);
63 | }
64 |
65 | if (! empty($this->soft_descriptor)) {
66 | $transaction->setSoftDescriptor($this->soft_descriptor);
67 | }
68 |
69 | if (! empty($this->partner_module) && ! empty($this->partner_gateway)) {
70 | $transaction->additional($this->partner_gateway, $this->partner_module);
71 | }
72 |
73 | $transaction = (new eRede($this->store, $this->get_logger()))->create($transaction);
74 |
75 | return $transaction;
76 | }
77 |
78 | /**
79 | * @param $id
80 | * @param $amount
81 | * @param int $installments
82 | * @param array $credit_card_data
83 | * @return Transaction|StdClass
84 | */
85 | public function doTransactionDebitRequest(
86 | $id,
87 | $amount,
88 | $credit_card_data = array()
89 | ) {
90 | $transaction = (new Transaction($amount, $id))->debitCard(
91 | $credit_card_data['card_number'],
92 | $credit_card_data['card_cvv'],
93 | $credit_card_data['card_expiration_month'],
94 | $credit_card_data['card_expiration_year'],
95 | $credit_card_data['card_holder']
96 | )->capture($this->capture);
97 |
98 | if (! empty($this->soft_descriptor)) {
99 | $transaction->setSoftDescriptor($this->soft_descriptor);
100 | }
101 |
102 | if (! empty($this->partner_module) && ! empty($this->partner_gateway)) {
103 | $transaction->additional($this->partner_gateway, $this->partner_module);
104 | }
105 |
106 | $transaction = (new eRede($this->store, $this->get_logger()))->create($transaction);
107 |
108 | return $transaction;
109 | }
110 |
111 | protected function get_logger()
112 | {
113 | $logger = new \Monolog\Logger('rede');
114 | $logger->pushHandler(new \Monolog\Handler\StreamHandler(WP_CONTENT_DIR . '/uploads/wc-logs/rede.log', \Monolog\Logger::DEBUG));
115 | $logger->info('Log Rede');
116 |
117 | return $logger;
118 | }
119 |
120 | public function do_transaction_consultation($tid)
121 | {
122 | return (new eRede($this->store, $this->get_logger()))->get($tid);
123 | }
124 |
125 | public function do_transaction_cancellation($tid, $amount = 0)
126 | {
127 | $transaction = (new eRede($this->store, $this->get_logger()))->cancel((new Transaction($amount))->setTid($tid));
128 |
129 | return $transaction;
130 | }
131 |
132 | public function do_transaction_capture($params)
133 | {
134 | $tid = $params['tid'];
135 | $amount = $params['amount'];
136 |
137 | try {
138 | $transaction = (new eRede($this->store, $this->get_logger()))->capture((new Transaction($amount))->setTid($tid));
139 | } catch (\Throwable $th) {
140 | return $th->getMessage();
141 | }
142 |
143 | return $transaction->getReturnMessage();
144 | }
145 | }
146 |
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceWcRedeCreditBlocks.php:
--------------------------------------------------------------------------------
1 | settings = get_option('woocommerce_rede_credit_settings', array());
16 | $this->gateway = new LknIntegrationRedeForWoocommerceWcRedeCredit();
17 | }
18 |
19 | public function is_active()
20 | {
21 | return $this->gateway->is_available();
22 | }
23 |
24 | public function get_payment_method_script_handles()
25 | {
26 | wp_enqueue_style('select-style', plugin_dir_url(INTEGRATION_REDE_FOR_WOOCOMMERCE_FILE) . '/Public/css/lknIntegrationRedeForWoocommerceSelectStyle.css', array(), '1.0.0', 'all');
27 | wp_register_script(
28 | 'rede_credit-blocks-integration',
29 | plugin_dir_url(__FILE__) . '../Public/js/creditCard/rede/lknIntegrationRedeForWoocommerceCheckoutCompiled.js',
30 | array(
31 | 'wc-blocks-registry',
32 | 'wc-settings',
33 | 'wp-element',
34 | 'wp-html-entities',
35 | 'wp-i18n',
36 | ),
37 | '1.0.0',
38 | true
39 | );
40 | if (function_exists('wp_set_script_translations')) {
41 | wp_set_script_translations('rede_credit-blocks-integration');
42 | }
43 | apply_filters('integrationRedeSetCustomCSSPro', get_option('woocommerce_rede_credit_settings')['custom_css_block_editor'] ?? false);
44 |
45 | return array('rede_credit-blocks-integration');
46 | }
47 |
48 | public function get_payment_method_data()
49 | {
50 | $cart_total = LknIntegrationRedeForWoocommerceHelper::getCartTotal();
51 | $settings = get_option('woocommerce_rede_credit_settings');
52 | $maxParcels = $settings['max_parcels_number'];
53 | $minParcelValue = (float) $settings['min_parcels_value'];
54 |
55 | $phpArray = array(
56 | 'title' => $this->gateway->title,
57 | 'description' => $this->gateway->description,
58 | 'nonceRedeCredit' => wp_create_nonce('redeCardNonce'),
59 | 'minInstallmentsRede' => get_option('woocommerce_rede_credit_settings')['min_parcels_value'],
60 | 'maxInstallmentsRede' => $maxParcels,
61 | 'cartTotal' => $cart_total,
62 | 'translations' => array(
63 | 'fieldsNotFilled' => __('Please fill in all fields correctly.', 'woo-rede'),
64 | 'cardNumber' => __('Card Number', 'woo-rede'),
65 | 'cardExpiringDate' => __('Card Expiring Date', 'woo-rede'),
66 | 'securityCode' => __('Security Code', 'woo-rede'),
67 | 'nameOnCard' => __('Name on Card', 'woo-rede'),
68 | 'installments' => __('Installments', 'woo-rede'),
69 | 'interestFree' => ' ' . __('interest-free', 'woo-rede'),
70 | )
71 | );
72 |
73 | if (
74 | isset($settings['installment_interest']) &&
75 | ($settings['installment_interest'] === 'yes' || $settings['installment_discount']) &&
76 | is_plugin_active('rede-for-woocommerce-pro/rede-for-woocommerce-pro.php')
77 | ) {
78 |
79 | for ($i = 1; $i <= $maxParcels; ++$i) {
80 | $parcelAmount = $cart_total / $i;
81 | if ($parcelAmount >= $minParcelValue) {
82 | $interest = round((float) $settings[$i . 'x'], 2);
83 | $customLabel = apply_filters('integrationRedeGetInterest', $cart_total, $interest, $i, 'label', $this->gateway);
84 |
85 | if($customLabel){
86 | $phpArray[$i . 'x'] = $customLabel;
87 | }
88 | }
89 | }
90 | } else {
91 | for ($i = 1; $i <= $maxParcels; ++$i) {
92 | $parcelAmount = $cart_total / $i;
93 | if ($parcelAmount >= $minParcelValue) {
94 | $phpArray[$i . 'x'] = html_entity_decode(sprintf('%dx de %s', $i, wp_strip_all_tags(wc_price($parcelAmount))));
95 | }
96 | }
97 | }
98 | return $phpArray;
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/Includes/LknIntegrationRedeForWoocommerceWcRedeDebitBlocks.php:
--------------------------------------------------------------------------------
1 | settings = get_option( 'woocommerce_rede_debit_settings', array() );
13 | $this->gateway = new LknIntegrationRedeForWoocommerceWcRedeDebit();
14 | }
15 |
16 | public function is_active() {
17 | return $this->gateway->is_available();
18 | }
19 |
20 | public function get_payment_method_script_handles() {
21 | wp_register_script(
22 | 'rede_debit-blocks-integration',
23 | plugin_dir_url( __FILE__ ) . '../Public/js/debitCard/rede/lknIntegrationRedeForWoocommerceCheckoutCompiled.js',
24 | array(
25 | 'wc-blocks-registry',
26 | 'wc-settings',
27 | 'wp-element',
28 | 'wp-html-entities',
29 | 'wp-i18n',
30 | ),
31 | '1.0.0',
32 | true
33 | );
34 | if ( function_exists( 'wp_set_script_translations' ) ) {
35 | wp_set_script_translations( 'rede_debit-blocks-integration');
36 | }
37 |
38 | apply_filters('integrationRedeSetCustomCSSPro', get_option('woocommerce_rede_debit_settings')['custom_css_block_editor'] ?? false);
39 | return array('rede_debit-blocks-integration');
40 | }
41 |
42 | public function get_payment_method_data() {
43 | $cart_total = LknIntegrationRedeForWoocommerceHelper::getCartTotal();
44 |
45 | return array(
46 | 'title' => $this->gateway->title,
47 | 'description' => $this->gateway->description,
48 | 'nonceRedeDebit' => wp_create_nonce( 'redeCardNonce' ),
49 | 'cartTotal' => $cart_total,
50 | 'translations' => array(
51 | 'fieldsNotFilled' => __('Please fill in all fields correctly.', 'woo-rede'),
52 | 'cardNumber' => __('Card Number', 'woo-rede'),
53 | 'cardExpiringDate' => __( 'Card Expiring Date', 'woo-rede' ),
54 | 'securityCode' => __('Security Code', 'woo-rede' ),
55 | 'nameOnCard' => __( 'Name on Card', 'woo-rede' ),
56 | )
57 | );
58 | }
59 | }
60 | ?>
--------------------------------------------------------------------------------
/Includes/index.php:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |

alt="Logo">
12 |
13 |
14 |
15 |
16 |
46 |
--------------------------------------------------------------------------------
/Includes/templates/pix/paymentPixQRCode.php:
--------------------------------------------------------------------------------
1 |
6 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 0s
23 |
24 |
25 |
26 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
40 |
41 |
42 |
43 |
50 |
51 |
55 | >
56 |
57 |
58 |
59 |
; ?>)
63 |
64 |
65 |
66 |
75 |
76 |
--------------------------------------------------------------------------------
/Includes/templates/pix/pixRedePaymentPaymentFields.php:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
29 |
--------------------------------------------------------------------------------
/Includes/views/LknIntegrationRedeForWoocommerceMetaTable.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | get_meta($meta_key);
7 | if (! empty($meta_value)) : ?>
8 |
9 |
10 | |
11 |
12 | |
13 |
14 |
16 |
17 |
--------------------------------------------------------------------------------
/Includes/views/notices/html-notice-woocommerce-missing.php:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
21 |
27 | :
28 | ' . esc_attr__( 'WooCommerce', 'woo-rede' ) . ''
36 | );
37 | ?>
38 |
39 |
--------------------------------------------------------------------------------
/Includes/views/notices/lkn-integration-rede-for-woocommerce-notice-download.php:
--------------------------------------------------------------------------------
1 |
6 |
7 |
Recomendação: Instale o plugin gratuito de prevenção contra fraudes para WooCommerce e aumente a segurança dos seus pedidos. Download
8 |
--------------------------------------------------------------------------------
/Public/LknIntegrationRedeForWoocommercePublic.php:
--------------------------------------------------------------------------------
1 |
23 | */
24 | final class LknIntegrationRedeForWoocommercePublic {
25 | /**
26 | * The ID of this plugin.
27 | *
28 | * @since 1.0.0
29 | * @access private
30 | * @var string $plugin_name The ID of this plugin.
31 | */
32 | private $plugin_name;
33 |
34 | /**
35 | * The version of this plugin.
36 | *
37 | * @since 1.0.0
38 | * @access private
39 | * @var string $version The current version of this plugin.
40 | */
41 | private $version;
42 |
43 | /**
44 | * Initialize the class and set its properties.
45 | *
46 | * @since 1.0.0
47 | * @param string $plugin_name The name of the plugin.
48 | * @param string $version The version of this plugin.
49 | */
50 | public function __construct($plugin_name, $version) {
51 | $this->plugin_name = $plugin_name;
52 | $this->version = $version;
53 | }
54 |
55 | /**
56 | * Register the stylesheets for the public-facing side of the site.
57 | *
58 | * @since 1.0.0
59 | */
60 | public function enqueue_styles(): void {
61 | /**
62 | * This function is provided for demonstration purposes only.
63 | *
64 | * An instance of this class should be passed to the run() function
65 | * defined in LknIntegrationRedeForWoocommerceLoader as all of the hooks are defined
66 | * in that particular class.
67 | *
68 | * The LknIntegrationRedeForWoocommerceLoader will then create the relationship
69 | * between the defined hooks and the functions defined in this
70 | * class.
71 | */
72 | wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/lknIntegrationRedeForWoocommercePublic.css', array(), $this->version, 'all');
73 | }
74 |
75 | /**
76 | * Register the JavaScript for the public-facing side of the site.
77 | *
78 | * @since 1.0.0
79 | */
80 | public function enqueue_scripts(): void {
81 | /**
82 | * This function is provided for demonstration purposes only.
83 | *
84 | * An instance of this class should be passed to the run() function
85 | * defined in LknIntegrationRedeForWoocommerceLoader as all of the hooks are defined
86 | * in that particular class.
87 | *
88 | * The LknIntegrationRedeForWoocommerceLoader will then create the relationship
89 | * between the defined hooks and the functions defined in this
90 | * class.
91 | */
92 | wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/lknIntegrationRedeForWoocommercePublic.js', array('jquery'), $this->version, false);
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/Public/css/lknIntegrationRedeForWoocommercePublic.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinkNacional/integration-rede-for-woocommerce/204f760bf740bddb103aa4565250eac60ea025c8/Public/css/lknIntegrationRedeForWoocommercePublic.css
--------------------------------------------------------------------------------
/Public/css/lknIntegrationRedeForWoocommerceSelectStyle.css:
--------------------------------------------------------------------------------
1 | .lknIntegrationRedeForWoocommerceSelect {
2 | width: 100% !important;
3 | }
4 |
5 | .lknIntegrationRedeForWoocommerceSelectBlocks {
6 | padding-top: 10px;
7 | }
--------------------------------------------------------------------------------
/Public/css/maxipago/styleMaxipagoCredit.css:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Inclusão do logo da maxipago
4 | *
5 | */
6 | #maxipago-credit-payment-form .payment-method-description {
7 | display: inline-flex;
8 | margin: 0 0 20px;
9 | display: flex;
10 | align-items: center;
11 | justify-content: center;
12 | padding: 0 1rem;
13 | }
14 |
15 | #maxipago-credit-payment-form .payment-method-description #logo-maxipago {
16 | height: 30px;
17 | margin-left: 0px;
18 | }
19 |
20 | /*
21 | *
22 | * Inclusão dos ícones das bandeiras dos cartões de crédito
23 | *
24 | */
25 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number {
26 | background-repeat: no-repeat;
27 | background-position: right 0.6180469716em center;
28 | background-size: 31px 20px;
29 | background-image: url("../../images/cards/unknown.svg");
30 | }
31 |
32 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.visa {
33 | background-image: url("../../images/cards/visa.svg");
34 | }
35 |
36 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.mastercard {
37 | background-image: url("../../images/cards/mastercard.svg");
38 | }
39 |
40 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.laser {
41 | background-image: url("../../images/cards/laser.svg");
42 | }
43 |
44 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.dinersclub {
45 | background-image: url("../../images/cards/diners.svg");
46 | }
47 |
48 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.maestro {
49 | background-image: url("../../images/cards/maestro.svg");
50 | }
51 |
52 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.jcb {
53 | background-image: url("../../images/cards/jcb.svg");
54 | }
55 |
56 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.amex {
57 | background-image: url("../../images/cards/amex.svg");
58 | }
59 |
60 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.discover {
61 | background-image: url("../../images/cards/discover.svg");
62 | }
63 |
64 | /*
65 | *
66 | * Inclusão dos ícones SVG nos inputs
67 | *
68 | */
69 | .maxipago-card {
70 | display: inline-block;
71 | position: relative;
72 | }
73 |
74 | .icon-maxipago-input {
75 | display: flex;
76 | align-items: center;
77 | }
78 |
79 | #labels-with-icons {
80 | display: flex;
81 | }
82 |
83 | select:focus {
84 | outline: none;
85 | }
86 |
87 | /*
88 | *
89 | * Ajustes à animação do cartão
90 | *
91 | */
92 | #maxipago-card-animation {
93 | margin: 10px 0 25px;
94 | }
95 |
96 | #maxipago-credit-payment-form {
97 | padding: 0 !important;
98 | }
99 |
100 | #maxipago-card-holder-name {
101 | text-transform: uppercase;
102 | }
103 |
104 | #maxipago-card-animation .jp-card .jp-card-front .jp-card-shiny {
105 | position: relative;
106 | top: -35px;
107 | }
108 |
109 | #maxipago-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-number {
110 | top: -30px;
111 | position: relative;
112 | margin-bottom: 0;
113 | }
114 |
115 | #maxipago-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-name {
116 | width: 275px;
117 | top: 60px;
118 | font-weight: 500;
119 | }
120 |
121 | #maxipago-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry {
122 | top: 15px;
123 | }
124 |
125 | #maxipago-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::after,
126 | #maxipago-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::before {
127 | opacity: 1;
128 | }
129 |
130 | .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::after {
131 | top: 12px;
132 | }
133 |
134 | #maxipago-card-animation .jp-card .jp-card-back,
135 | #maxipago-card-animation .jp-card .jp-card-front {
136 | background: #C1C1C1;
137 | }
138 |
139 | #maxipago-card-animation .jp-card .jp-card-back .jp-card-display,
140 | #maxipago-card-animation .jp-card .jp-card-front .jp-card-display {
141 | opacity: 0.7;
142 | }
--------------------------------------------------------------------------------
/Public/css/maxipago/styleMaxipagoDebit.css:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Inclusão do logo da maxipago
4 | *
5 | */
6 | #maxipagoDebitPaymentForm .paymentMethodDescription {
7 | display: inline-flex;
8 | margin: 0 0 20px;
9 | display: flex;
10 | align-items: center;
11 | justify-content: center;
12 | padding: 0 1rem;
13 | }
14 |
15 | #maxipagoDebitPaymentForm .paymentMethodDescription #logoMaxipago {
16 | height: 30px;
17 | margin-left: 0px;
18 | }
19 |
20 | /*
21 | *
22 | * Inclusão dos ícones das bandeiras dos cartões de crédito
23 | *
24 | */
25 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number {
26 | background-repeat: no-repeat;
27 | background-position: right 0.6180469716em center;
28 | background-size: 31px 20px;
29 | background-image: url("../../images/cards/unknown.svg");
30 | }
31 |
32 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.visa {
33 | background-image: url("../../images/cards/visa.svg");
34 | }
35 |
36 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.mastercard {
37 | background-image: url("../../images/cards/mastercard.svg");
38 | }
39 |
40 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.laser {
41 | background-image: url("../../images/cards/laser.svg");
42 | }
43 |
44 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.dinersclub {
45 | background-image: url("../../images/cards/diners.svg");
46 | }
47 |
48 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.maestro {
49 | background-image: url("../../images/cards/maestro.svg");
50 | }
51 |
52 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.jcb {
53 | background-image: url("../../images/cards/jcb.svg");
54 | }
55 |
56 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.amex {
57 | background-image: url("../../images/cards/amex.svg");
58 | }
59 |
60 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.discover {
61 | background-image: url("../../images/cards/discover.svg");
62 | }
63 |
64 | /*
65 | *
66 | * Inclusão dos ícones SVG nos inputs
67 | *
68 | */
69 | .maxipago-card {
70 | display: inline-block;
71 | position: relative;
72 | }
73 |
74 | .icon-maxipago-input {
75 | display: flex;
76 | align-items: center;
77 | }
78 |
79 | #labels-with-icons {
80 | display: flex;
81 | }
82 |
83 | select:focus {
84 | outline: none;
85 | }
86 |
87 | /*
88 | *
89 | * Ajustes à animação do cartão
90 | *
91 | */
92 | #maxipagoDebitCardAnimation {
93 | margin: 10px 0 25px;
94 | }
95 |
96 | #maxipagoDebitPaymentForm {
97 | padding: 0 !important;
98 | }
99 |
100 | #maxipago_debit_card_holder_name {
101 | text-transform: uppercase;
102 | }
103 |
104 | #maxipagoDebitCardAnimation .jp-card .jp-card-front .jp-card-shiny {
105 | position: relative;
106 | top: -35px;
107 | }
108 |
109 | #maxipagoDebitCardAnimation .jp-card .jp-card-front .jp-card-lower .jp-card-number {
110 | top: -30px;
111 | position: relative;
112 | margin-bottom: 0;
113 | }
114 |
115 | #maxipagoDebitCardAnimation .jp-card .jp-card-front .jp-card-lower .jp-card-name {
116 | width: 275px;
117 | top: 60px;
118 | font-weight: 500;
119 | }
120 |
121 | #maxipagoDebitCardAnimation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry {
122 | top: 15px;
123 | }
124 |
125 | #maxipagoDebitCardAnimation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::after,
126 | #maxipagoDebitCardAnimation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::before {
127 | opacity: 1;
128 | }
129 |
130 | .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::after {
131 | top: 12px;
132 | }
133 |
134 | #maxipagoDebitCardAnimation .jp-card .jp-card-back,
135 | #maxipagoDebitCardAnimation .jp-card .jp-card-front {
136 | background: #C1C1C1;
137 | }
138 |
139 | #maxipagoDebitCardAnimation .jp-card .jp-card-back .jp-card-display,
140 | #maxipagoDebitCardAnimation .jp-card .jp-card-front .jp-card-display {
141 | opacity: 0.7;
142 | }
--------------------------------------------------------------------------------
/Public/css/rede/LknIntegrationRedeForWoocommercePaymentFields.css:
--------------------------------------------------------------------------------
1 | #LknRedeForWoocommerceProPixImage {
2 | height: 30px;
3 | margin-left: 0px !important;
4 | }
5 |
6 | .LknIntegrationRedeForWoocommercePaymentFields {
7 | display: flex;
8 | align-items: center;
9 | justify-content: center;
10 | }
11 |
12 | .LknIntegrationRedeForWoocommercePaymentFields svg {
13 | width: 60px;
14 | margin-left: 10px;
15 | }
16 |
17 | #LknIntegrationRedeForWoocommercePaymentFields {
18 | display: flex;
19 | justify-content: center;
20 | }
21 |
22 | #LknIntegrationRedeForWoocommercePaymentFields svg {
23 | width: 60px;
24 | margin-left: 10px;
25 | }
--------------------------------------------------------------------------------
/Public/css/rede/LknIntegrationRedeForWoocommercePix.css:
--------------------------------------------------------------------------------
1 | #pix_integration_new_content {
2 | display: flex;
3 | align-self: center;
4 | justify-self: center;
5 | flex-wrap: wrap-reverse;
6 | align-items: flex-end;
7 | justify-content: space-evenly;
8 | flex-direction: row;
9 | border: 1px solid #E6E6E6;
10 | border-radius: 10px;
11 | box-shadow: -2px 2px 4px #E6E6E6;
12 | padding: 20px;
13 | height: min-content;
14 | box-sizing: border-box;
15 | margin: 50px 0px;
16 | background-color: #fff;
17 | }
18 |
19 | .container_pix {
20 | display: flex;
21 | flex-direction: column;
22 | justify-content: center;
23 | align-items: center;
24 | width: 450px;
25 | height: 100%;
26 | box-sizing: border-box;
27 | padding: 40px;
28 | }
29 |
30 | .span_title_container {
31 | display: flex;
32 | align-items: start;
33 | width: 100%;
34 | padding-left: 20px;
35 | box-sizing: border-box;
36 | }
37 |
38 | .span_title_text {
39 | font-size: 20px;
40 | color: black;
41 | }
42 |
43 | .span_content_text {
44 | font-size: 20px;
45 | color: #838383;
46 | }
47 |
48 | .schedule_check_container {
49 | display: flex;
50 | flex-direction: column;
51 | align-items: center;
52 | justify-content: center;
53 | margin-top: 16px;
54 | }
55 |
56 | .schedule_text {
57 | font-size: 12px;
58 | text-align: center;
59 | color: #838383;
60 | }
61 |
62 | #timer {
63 | font-size: 48px;
64 | color: #3A3A3A;
65 | text-align: center
66 | }
67 |
68 | .payment_check_container {
69 | display: flex;
70 | justify-content: center;
71 | width: 100%;
72 | }
73 |
74 | .payment_check_button {
75 | display: flex;
76 | width: 350px;
77 | height: 50px;
78 | border-radius: 8px;
79 | align-items: center;
80 | justify-content: center;
81 | background-color: #D9D9D9;
82 | color: #FFF;
83 | font-size: 20px;
84 | border: none;
85 | outline: none;
86 | box-shadow: none;
87 | margin-top: 16px;
88 | transition: background-color 0.5s ease;
89 | }
90 |
91 | .payment_check_button[disabled]:hover {
92 | background-color: #D9D9D9;
93 | }
94 |
95 | .payment_check_text {
96 | display: flex;
97 | justify-content: center;
98 | text-align: center;
99 | max-width: 350px;
100 | font-size: 16px;
101 | color: #838383;
102 | }
103 |
104 | .span_title_value {
105 | font-size: 20px;
106 | color: #686868;
107 | font-weight: bold;
108 | text-align: center;
109 | }
110 |
111 | .span_total_value {
112 | font-size: 32px;
113 | font-weight: bold;
114 | color: black;
115 | margin-top: -10px;
116 | }
117 |
118 | .span_date {
119 | font-size: 20px;
120 | color: #686868;
121 | margin-bottom: 10px;
122 | text-align: center;
123 | }
124 |
125 | #span_container {
126 | display: flex;
127 | flex-direction: column;
128 | align-items: center;
129 | }
130 |
131 | #copy_container {
132 | display: flex;
133 | align-items: center;
134 | width: 360px;
135 | border-radius: 8px;
136 | height: 50px;
137 | overflow: hidden;
138 | background-color: #D9D9D9;
139 | margin-bottom: 20px;
140 | }
141 |
142 | .input_copy_code {
143 | width: 100%;
144 | height: 32px;
145 | background-color: #D9D9D9;
146 | border: none;
147 | outline: none;
148 | box-shadow: none;
149 | padding-left: 10px;
150 | }
151 |
152 | .input_copy_code[disabled] {
153 | background-color: #D9D9D9 !important;
154 | }
155 |
156 | .button_copy_code {
157 | width: 100px !important;
158 | height: 100%;
159 | background-color: #3A3A3A;
160 | font-size: 12px;
161 | color: #FFF;
162 | border: none;
163 | outline: none;
164 | box-shadow: none;
165 | cursor: pointer;
166 | text-align: center;
167 | padding: 0px !important;
168 | transition: background-color 0.5s ease;
169 | }
170 |
171 | .button_copy_code:hover {
172 | background-color: #3A3A3A;
173 | }
174 |
175 | .button_copy_code[disabled] {
176 | background-color: #28a428;
177 | }
178 |
179 | .pix_img {
180 | width: 300px;
181 | height: auto;
182 | }
183 |
184 | .share_container {
185 | display: flex;
186 | width: 100%;
187 | justify-content: end;
188 | display: none;
189 | overflow: hidden;
190 | background-color: transparent;
191 | }
192 |
193 | .share_button {
194 | display: flex;
195 | align-items: center;
196 | justify-content: center;
197 | width: 32px;
198 | height: 32px;
199 | background-color: #fff;
200 | border: none;
201 | outline: none;
202 | box-shadow: none;
203 | cursor: pointer;
204 | padding: 0px;
205 | background-color: transparent;
206 | }
207 |
208 | @media screen and (max-width: 986px) {
209 | #pix_integration_new_content {
210 | flex-direction: column-reverse;
211 | align-items: center;
212 | margin: 20px 0px;
213 | }
214 | }
215 |
216 | @media screen and (max-width: 768px) {
217 | .share_container {
218 | display: flex;
219 | }
220 | }
221 |
222 | @media screen and (max-width: 586px) {
223 | .container_pix {
224 | width: 100%;
225 | padding: 20px 0px;
226 | }
227 |
228 | .span_title_text {
229 | font-size: 16px;
230 | }
231 |
232 | .span_content_text {
233 | font-size: 16px;
234 | }
235 |
236 | .payment_check_button {
237 | font-size: 16px;
238 | }
239 |
240 | .payment_check_text {
241 | font-size: 14px;
242 | }
243 |
244 | .pix_img {
245 | width: 100%;
246 | }
247 |
248 | #copy_container {
249 | width: 100%;
250 | max-width: 360px;
251 | }
252 |
253 | .input_copy_code {
254 | max-width: 288px;
255 | }
256 | }
--------------------------------------------------------------------------------
/Public/css/rede/LknIntegrationRedeForWoocommercePixDivi.css:
--------------------------------------------------------------------------------
1 | #span_container{
2 | gap: 20px;
3 | margin-bottom: 10px;
4 | }
5 |
6 | .container_pix ol{
7 | margin-left: 22px;
8 | margin-top: 10px;
9 | }
10 |
11 | #timer{
12 | margin: 15px;
13 | }
14 |
15 | #copy_container{
16 | padding-left: 10px;
17 | }
--------------------------------------------------------------------------------
/Public/css/rede/styleRedeCredit.css:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Inclusão do logo da Rede
4 | *
5 | */
6 | #rede-credit-payment-form .payment-method-description {
7 | display: inline-flex;
8 | margin: 0 0 20px;
9 | display: flex;
10 | align-items: center;
11 | justify-content: center;
12 | padding: 0 1rem;
13 | }
14 |
15 | #rede-credit-payment-form .payment-method-description #logo-rede {
16 | width: 60px;
17 | margin-left: 10px;
18 | }
19 |
20 | /*
21 | *
22 | * Inclusão dos ícones das bandeiras dos cartões de crédito
23 | *
24 | */
25 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number {
26 | background-repeat: no-repeat;
27 | background-position: right 0.6180469716em center;
28 | background-size: 31px 20px;
29 | background-image: url("../../images/cards/unknown.svg");
30 | }
31 |
32 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.visa {
33 | background-image: url("../../images/cards/visa.svg");
34 | }
35 |
36 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.mastercard {
37 | background-image: url("../../images/cards/mastercard.svg");
38 | }
39 |
40 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.laser {
41 | background-image: url("../../images/cards/laser.svg");
42 | }
43 |
44 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.dinersclub {
45 | background-image: url("../../images/cards/diners.svg");
46 | }
47 |
48 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.maestro {
49 | background-image: url("../../images/cards/maestro.svg");
50 | }
51 |
52 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.jcb {
53 | background-image: url("../../images/cards/jcb.svg");
54 | }
55 |
56 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.amex {
57 | background-image: url("../../images/cards/amex.svg");
58 | }
59 |
60 | #payment .payment_methods li .payment_box .wc-credit-card-form-card-number.discover {
61 | background-image: url("../../images/cards/discover.svg");
62 | }
63 |
64 | /*
65 | *
66 | * Inclusão dos ícones SVG nos inputs
67 | *
68 | */
69 | .rede-card {
70 | display: inline-block;
71 | position: relative;
72 | }
73 |
74 | .icon-rede-input {
75 | display: flex;
76 | align-items: center;
77 | }
78 |
79 | #labels-with-icons {
80 | display: flex;
81 | }
82 |
83 | select:focus {
84 | outline: none;
85 | }
86 |
87 | /*
88 | *
89 | * Ajustes à animação do cartão
90 | *
91 | */
92 | #rede-card-animation {
93 | margin: 10px 0 25px;
94 | }
95 |
96 | #rede-credit-payment-form {
97 | padding: 0 !important;
98 | }
99 |
100 | #rede-card-holder-name {
101 | text-transform: uppercase;
102 | }
103 |
104 | #rede-card-animation .jp-card .jp-card-front .jp-card-shiny {
105 | position: relative;
106 | top: -35px;
107 | }
108 |
109 | #rede-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-number {
110 | top: -30px;
111 | position: relative;
112 | margin-bottom: 0;
113 | }
114 |
115 | #rede-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-name {
116 | width: 275px;
117 | top: 60px;
118 | font-weight: 500;
119 | }
120 |
121 | #rede-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry {
122 | top: 15px;
123 | }
124 |
125 | #rede-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::after,
126 | #rede-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::before {
127 | opacity: 1;
128 | }
129 |
130 | .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::after {
131 | top: 12px;
132 | }
133 |
134 | #rede-card-animation .jp-card .jp-card-back,
135 | #rede-card-animation .jp-card .jp-card-front {
136 | background: #C1C1C1;
137 | }
138 |
139 | #rede-card-animation .jp-card .jp-card-back .jp-card-display,
140 | #rede-card-animation .jp-card .jp-card-front .jp-card-display {
141 | opacity: 0.7;
142 | }
--------------------------------------------------------------------------------
/Public/css/rede/styleRedeDebit.css:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Inclusão do logo da Rede
4 | *
5 | */
6 | #rede-debit-payment-form .payment-method-description {
7 | display: inline-flex;
8 | margin: 0 0 20px;
9 | display: flex;
10 | align-items: center;
11 | padding: 0 1rem;
12 | justify-content: center;
13 | }
14 |
15 | #rede-debit-payment-form .payment-method-description #logo-rede {
16 | width: 60px;
17 | margin-left: 10px;
18 | }
19 |
20 | /*
21 | *
22 | * Inclusão dos ícones das bandeiras dos cartões de crédito
23 | *
24 | */
25 | #payment .payment_methods li .payment_box .wc-debit-card-form-card-number {
26 | background-repeat: no-repeat;
27 | background-position: right 0.6180469716em center;
28 | background-size: 31px 20px;
29 | background-image: url("../../images/cards/unknown.svg");
30 | }
31 |
32 | #payment .payment_methods li .payment_box .wc-debit-card-form-card-number.visa {
33 | background-image: url("../images/cards/visa.svg");
34 | }
35 |
36 | #payment .payment_methods li .payment_box .wc-debit-card-form-card-number.mastercard {
37 | background-image: url("../images/cards/mastercard.svg");
38 | }
39 |
40 | #payment .payment_methods li .payment_box .wc-debit-card-form-card-number.laser {
41 | background-image: url("../images/cards/laser.svg");
42 | }
43 |
44 | #payment .payment_methods li .payment_box .wc-debit-card-form-card-number.dinersclub {
45 | background-image: url("../images/cards/diners.svg");
46 | }
47 |
48 | #payment .payment_methods li .payment_box .wc-debit-card-form-card-number.maestro {
49 | background-image: url("../images/cards/maestro.svg");
50 | }
51 |
52 | #payment .payment_methods li .payment_box .wc-debit-card-form-card-number.jcb {
53 | background-image: url("../images/cards/jcb.svg");
54 | }
55 |
56 | #payment .payment_methods li .payment_box .wc-debit-card-form-card-number.amex {
57 | background-image: url("../images/cards/amex.svg");
58 | }
59 |
60 | #payment .payment_methods li .payment_box .wc-debit-card-form-card-number.discover {
61 | background-image: url("../images/cards/discover.svg");
62 | }
63 |
64 | /*
65 | *
66 | * Inclusão dos ícones SVG nos inputs
67 | *
68 | */
69 | .rede-card {
70 | display: inline-block;
71 | position: relative;
72 | }
73 |
74 | .icon-rede-input {
75 | display: flex;
76 | align-items: center;
77 | }
78 |
79 | #labels-with-icons {
80 | display: flex;
81 | }
82 |
83 | select:focus {
84 | outline: none;
85 | }
86 |
87 | /*
88 | *
89 | * Ajustes à animação do cartão
90 | *
91 | */
92 | #rede-debit-card-animation {
93 | margin: 10px 0 25px;
94 | }
95 |
96 | #rede-debit-payment-form {
97 | padding: 0 !important;
98 | }
99 |
100 | #rede-debit-card-holder-name {
101 | text-transform: uppercase;
102 | }
103 |
104 | #rede-debit-card-animation .jp-card .jp-card-front .jp-card-shiny {
105 | position: relative;
106 | top: -35px;
107 | }
108 |
109 | #rede-debit-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-number {
110 | top: -30px;
111 | position: relative;
112 | margin-bottom: 0;
113 | }
114 |
115 | #rede-debit-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-name {
116 | width: 275px;
117 | top: 60px;
118 | font-weight: 500;
119 | }
120 |
121 | #rede-debit-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry {
122 | top: 15px;
123 | }
124 |
125 | #rede-debit-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::after,
126 | #rede-debit-card-animation .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::before {
127 | opacity: 1;
128 | }
129 |
130 | .jp-card .jp-card-front .jp-card-lower .jp-card-expiry::after {
131 | top: 12px;
132 | }
133 |
134 | #rede-debit-card-animation .jp-card .jp-card-back,
135 | #rede-debit-card-animation .jp-card .jp-card-front {
136 | background: #C1C1C1;
137 | }
138 |
139 | #rede-debit-card-animation .jp-card .jp-card-back .jp-card-display,
140 | #rede-debit-card-animation .jp-card .jp-card-front .jp-card-display {
141 | opacity: 0.7;
142 | }
--------------------------------------------------------------------------------
/Public/images/cards/diners.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Public/images/cards/discover.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Public/images/cards/jcb.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Public/images/cards/laser.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
72 |
--------------------------------------------------------------------------------
/Public/images/cards/paypal.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
53 |
--------------------------------------------------------------------------------
/Public/images/cards/unknown.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
--------------------------------------------------------------------------------
/Public/images/cards/visa.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Public/images/maxipago.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinkNacional/integration-rede-for-woocommerce/204f760bf740bddb103aa4565250eac60ea025c8/Public/images/maxipago.png
--------------------------------------------------------------------------------
/Public/images/share.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/Public/images/telegram.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Public/index.php:
--------------------------------------------------------------------------------
1 | {
10 | const {
11 | eventRegistration,
12 | emitResponse
13 | } = props;
14 | const {
15 | onPaymentSetup
16 | } = eventRegistration;
17 | const wcComponents = window.wc.blocksComponents;
18 | const [debitObject, setDebitObject] = window.wp.element.useState({
19 | rede_debit_number: '',
20 | rede_debit_installments: '1',
21 | rede_debit_expiry: '',
22 | rede_debit_cvc: '',
23 | rede_debit_holder_name: ''
24 | });
25 | const [focus, setFocus] = window.wp.element.useState('');
26 | const formatDebitCardNumber = value => {
27 | if (value?.length > 19) return debitObject.rede_debit_number;
28 | // Remove caracteres não numéricos
29 | const cleanedValue = value?.replace(/\D/g, '');
30 | // Adiciona espaços a cada quatro dígitos
31 | const formattedValue = cleanedValue?.replace(/(.{4})/g, '$1 ')?.trim();
32 | return formattedValue;
33 | };
34 | const updateDebitObject = (key, value) => {
35 | let isValidDate = false;
36 | switch (key) {
37 | case 'rede_debit_expiry':
38 | if (value.length > 7) return;
39 |
40 | // Verifica se o valor é uma data válida (MM/YY)
41 | isValidDate = /^\d{2}\/\d{2}$/.test(value);
42 | if (!isValidDate) {
43 | // Remove caracteres não numéricos
44 | const cleanedValue = value?.replace(/\D/g, '');
45 | let formattedValue = cleanedValue?.replace(/^(.{2})/, '$1 / ')?.trim();
46 |
47 | // Se o tamanho da string for 5, remove o espaço e a barra adicionados anteriormente
48 | if (formattedValue.length === 4) {
49 | formattedValue = formattedValue.replace(/\s\//, '');
50 | }
51 |
52 | // Atualiza o estado
53 | setDebitObject({
54 | ...debitObject,
55 | [key]: formattedValue
56 | });
57 | }
58 | return;
59 | case 'rede_debit_cvc':
60 | if (!/^\d+$/.test(value) && value !== '' || value.length > 4) return;
61 | break;
62 | default:
63 | break;
64 | }
65 | setDebitObject({
66 | ...debitObject,
67 | [key]: value
68 | });
69 | };
70 | window.wp.element.useEffect(() => {
71 | const unsubscribe = onPaymentSetup(async () => {
72 | // Verifica se todos os campos do debitObject estão preenchidos
73 | const allFieldsFilled = Object.values(debitObject).every(field => field.trim() !== '');
74 | if (allFieldsFilled) {
75 | return {
76 | type: emitResponse.responseTypes.SUCCESS,
77 | meta: {
78 | paymentMethodData: {
79 | rede_debit_number: debitObject.rede_debit_number,
80 | rede_debit_installments: debitObject.rede_debit_installments,
81 | rede_debit_expiry: debitObject.rede_debit_expiry,
82 | rede_debit_cvc: debitObject.rede_debit_cvc,
83 | rede_debit_holder_name: debitObject.rede_debit_holder_name,
84 | rede_card_nonce: nonceRedeDebit
85 | }
86 | }
87 | };
88 | }
89 | return {
90 | type: emitResponse.responseTypes.ERROR,
91 | message: translationsRedeDebit.fieldsNotFilled
92 | };
93 | });
94 |
95 | // Cancela a inscrição quando este componente é desmontado.
96 | return () => {
97 | unsubscribe();
98 | };
99 | }, [debitObject,
100 | // Adiciona debitObject como dependência
101 | emitResponse.responseTypes.ERROR, emitResponse.responseTypes.SUCCESS, onPaymentSetup, translationsRedeDebit // Adicione translationsRedeDebit como dependência
102 | ]);
103 | return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Cards, {
104 | number: debitObject.rede_debit_number,
105 | name: debitObject.rede_debit_holder_name,
106 | expiry: debitObject.rede_debit_expiry.replace(/\s+/g, ''),
107 | cvc: debitObject.rede_debit_cvc,
108 | placeholders: {
109 | name: 'NOME',
110 | expiry: 'MM/ANO',
111 | cvc: 'CVC',
112 | number: '•••• •••• •••• ••••'
113 | },
114 | locale: {
115 | valid: 'VÁLIDO ATÉ'
116 | },
117 | focused: focus
118 | }), /*#__PURE__*/React.createElement(wcComponents.TextInput, {
119 | id: "rede_debit_holder_name",
120 | label: translationsRedeDebit.nameOnCard,
121 | value: debitObject.rede_debit_holder_name,
122 | maxLength: 30,
123 | onChange: value => {
124 | updateDebitObject('rede_debit_holder_name', value);
125 | },
126 | onFocus: () => setFocus('name')
127 | }), /*#__PURE__*/React.createElement(wcComponents.TextInput, {
128 | id: "rede_debit_number",
129 | label: translationsRedeDebit.cardNumber,
130 | value: formatDebitCardNumber(debitObject.rede_debit_number),
131 | onChange: value => {
132 | updateDebitObject('rede_debit_number', formatDebitCardNumber(value));
133 | },
134 | onFocus: () => setFocus('number')
135 | }), /*#__PURE__*/React.createElement(wcComponents.TextInput, {
136 | id: "rede_debit_expiry",
137 | label: translationsRedeDebit.cardExpiringDate,
138 | value: debitObject.rede_debit_expiry,
139 | onChange: value => {
140 | updateDebitObject('rede_debit_expiry', value);
141 | },
142 | onFocus: () => setFocus('expiry')
143 | }), /*#__PURE__*/React.createElement(wcComponents.TextInput, {
144 | id: "rede_debit_cvc",
145 | label: translationsRedeDebit.securityCode,
146 | value: debitObject.rede_debit_cvc,
147 | onChange: value => {
148 | updateDebitObject('rede_debit_cvc', value);
149 | },
150 | onFocus: () => setFocus('cvc')
151 | }));
152 | };
153 | const BlockGatewayRedeDebit = {
154 | name: 'rede_debit',
155 | label: labelRedeDebit,
156 | content: window.wp.element.createElement(ContentRedeDebit),
157 | edit: window.wp.element.createElement(ContentRedeDebit),
158 | canMakePayment: () => true,
159 | ariaLabel: labelRedeDebit,
160 | supports: {
161 | features: settingsRedeDebit.supports
162 | }
163 | };
164 | window.wc.wcBlocksRegistry.registerPaymentMethod(BlockGatewayRedeDebit);
--------------------------------------------------------------------------------
/Public/js/debitCard/rede/lknIntegrationRedeForWoocommerceCheckout.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Cards from 'react-credit-cards';
3 | import 'react-credit-cards/es/styles-compiled.css';
4 | const settingsRedeDebit = window.wc.wcSettings.getSetting('rede_debit_data', {})
5 | const labelRedeDebit = window.wp.htmlEntities.decodeEntities(settingsRedeDebit.title)
6 | // Obtendo o nonce da variável global
7 | const nonceRedeDebit = settingsRedeDebit.nonceRedeDebit
8 | const translationsRedeDebit = settingsRedeDebit.translations
9 |
10 | const ContentRedeDebit = (props) => {
11 | const { eventRegistration, emitResponse } = props
12 | const { onPaymentSetup } = eventRegistration
13 | const wcComponents = window.wc.blocksComponents
14 | const [debitObject, setDebitObject] = window.wp.element.useState({
15 | rede_debit_number: '',
16 | rede_debit_installments: '1',
17 | rede_debit_expiry: '',
18 | rede_debit_cvc: '',
19 | rede_debit_holder_name: ''
20 | })
21 | const [focus, setFocus] = window.wp.element.useState('')
22 |
23 | const formatDebitCardNumber = value => {
24 | if (value?.length > 19) return debitObject.rede_debit_number
25 | // Remove caracteres não numéricos
26 | const cleanedValue = value?.replace(/\D/g, '')
27 | // Adiciona espaços a cada quatro dígitos
28 | const formattedValue = cleanedValue?.replace(/(.{4})/g, '$1 ')?.trim()
29 | return formattedValue
30 | }
31 |
32 | const updateDebitObject = (key, value) => {
33 | let isValidDate = false
34 |
35 | switch (key) {
36 | case 'rede_debit_expiry':
37 | if (value.length > 7) return
38 |
39 | // Verifica se o valor é uma data válida (MM/YY)
40 | isValidDate = /^\d{2}\/\d{2}$/.test(value)
41 | if (!isValidDate) {
42 | // Remove caracteres não numéricos
43 | const cleanedValue = value?.replace(/\D/g, '')
44 | let formattedValue = cleanedValue?.replace(/^(.{2})/, '$1 / ')?.trim()
45 |
46 | // Se o tamanho da string for 5, remove o espaço e a barra adicionados anteriormente
47 | if (formattedValue.length === 4) {
48 | formattedValue = formattedValue.replace(/\s\//, '')
49 | }
50 |
51 | // Atualiza o estado
52 | setDebitObject({
53 | ...debitObject,
54 | [key]: formattedValue
55 | })
56 | }
57 | return
58 | case 'rede_debit_cvc':
59 | if ((!/^\d+$/.test(value) && value !== '') || value.length > 4) return
60 | break
61 | default:
62 | break
63 | }
64 | setDebitObject({
65 | ...debitObject,
66 | [key]: value
67 | })
68 | }
69 |
70 | window.wp.element.useEffect(() => {
71 | const unsubscribe = onPaymentSetup(async () => {
72 | // Verifica se todos os campos do debitObject estão preenchidos
73 | const allFieldsFilled = Object.values(debitObject).every((field) => field.trim() !== '')
74 |
75 | if (allFieldsFilled) {
76 | return {
77 | type: emitResponse.responseTypes.SUCCESS,
78 | meta: {
79 | paymentMethodData: {
80 | rede_debit_number: debitObject.rede_debit_number,
81 | rede_debit_installments: debitObject.rede_debit_installments,
82 | rede_debit_expiry: debitObject.rede_debit_expiry,
83 | rede_debit_cvc: debitObject.rede_debit_cvc,
84 | rede_debit_holder_name: debitObject.rede_debit_holder_name,
85 | rede_card_nonce: nonceRedeDebit
86 | }
87 | }
88 | }
89 | }
90 | return {
91 | type: emitResponse.responseTypes.ERROR,
92 | message: translationsRedeDebit.fieldsNotFilled
93 | }
94 | })
95 |
96 | // Cancela a inscrição quando este componente é desmontado.
97 | return () => {
98 | unsubscribe()
99 | }
100 | }, [
101 | debitObject, // Adiciona debitObject como dependência
102 | emitResponse.responseTypes.ERROR,
103 | emitResponse.responseTypes.SUCCESS,
104 | onPaymentSetup,
105 | translationsRedeDebit // Adicione translationsRedeDebit como dependência
106 | ])
107 |
108 | return (
109 | <>
110 |
124 | {
130 | updateDebitObject('rede_debit_holder_name', value)
131 | }}
132 | onFocus={() => setFocus('name')}
133 | />
134 |
135 | {
140 | updateDebitObject('rede_debit_number', formatDebitCardNumber(value))
141 | }}
142 | onFocus={() => setFocus('number')}
143 | />
144 |
145 | {
150 | updateDebitObject('rede_debit_expiry', value)
151 | }}
152 | onFocus={() => setFocus('expiry')}
153 | />
154 |
155 | {
160 | updateDebitObject('rede_debit_cvc', value)
161 | }}
162 | onFocus={() => setFocus('cvc')}
163 | />
164 | >
165 | )
166 | }
167 |
168 | const BlockGatewayRedeDebit = {
169 | name: 'rede_debit',
170 | label: labelRedeDebit,
171 | content: window.wp.element.createElement(ContentRedeDebit),
172 | edit: window.wp.element.createElement(ContentRedeDebit),
173 | canMakePayment: () => true,
174 | ariaLabel: labelRedeDebit,
175 | supports: {
176 | features: settingsRedeDebit.supports
177 | }
178 | }
179 |
180 | window.wc.wcBlocksRegistry.registerPaymentMethod(BlockGatewayRedeDebit)
181 |
--------------------------------------------------------------------------------
/Public/js/debitCard/rede/lknIntegrationRedeForWoocommerceCheckoutCompiled.js.LICENSE.txt:
--------------------------------------------------------------------------------
1 | /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
2 |
3 | /**
4 | * @license React
5 | * react.production.min.js
6 | *
7 | * Copyright (c) Facebook, Inc. and its affiliates.
8 | *
9 | * This source code is licensed under the MIT license found in the
10 | * LICENSE file in the root directory of this source tree.
11 | */
12 |
--------------------------------------------------------------------------------
/Public/js/debitCard/rede/wooRedeDebit.js:
--------------------------------------------------------------------------------
1 | window.jQuery(function ($) {
2 | // Verifica se janela foi carregada antes da criação do card
3 | $(window).on('load', lknRedeDebitCardRender)
4 | // Cria o card somente quando a requisição for concluida
5 | $(document).on('updated_checkout', lknRedeDebitCardRender)
6 | $(document).on('wc-fragment-refreshed', lknRedeDebitCardRender)
7 | $(document).on('woocommerce_cart_updated', lknRedeDebitCardRender)
8 | $(document).on('woocommerce_checkout_update_order_review', lknRedeDebitCardRender)
9 | // Fallback para quando o evento não é disparado
10 | lknRedeDebitCardRender()
11 |
12 | function lknRedeDebitCardRender () {
13 | if (!document.querySelector('.wc-block-checkout')) {
14 | // Cria o card somente quando a requisição for concluida
15 | let $form = $('.woocommerce .woocommerce-checkout')
16 | if ($form.length === 0) {
17 | $form = $('#order_review')
18 | }
19 | const selectedPaymentMethod = $form.find('input[name="payment_method"]:checked')
20 | const inputDebitNumber = $form.find('#rede-card-number')
21 | if (selectedPaymentMethod && selectedPaymentMethod.val() !== 'rede_debit' && !inputDebitNumber) {
22 | return
23 | }
24 | const inputSelectors = {
25 | numberInput: '#rede-debit-card-number',
26 | nameInput: '#rede-debit-card-holder-name',
27 | expiryInput: '#rede-debit-card-expiry',
28 | cvcInput: '#rede-debit-card-cvc'
29 | }
30 |
31 | // maybe delete old card data
32 | $form.data('card', null)
33 |
34 | // init animated card
35 | $form.card({
36 | container: '#rede-debit-card-animation',
37 |
38 | /**
39 | * Selectors
40 | */
41 | formSelectors: inputSelectors,
42 |
43 | /**
44 | * Placeholders
45 | */
46 | placeholders: {
47 | number: '•••• •••• •••• ••••',
48 | name: 'NOME',
49 | expiry: 'MM/ANO',
50 | cvc: 'CVC'
51 | },
52 |
53 | /**
54 | * Translation Brazilian Portuguese
55 | */
56 | messages: {
57 | validDate: 'VALIDADE',
58 | monthYear: ''
59 | },
60 |
61 | /**
62 | * Debug
63 | */
64 | debug: !!window.wooRede.debug
65 | })
66 |
67 | // Workaround to maintain the card data rendered after checkout updates
68 | Object.values(inputSelectors).reverse().forEach(function (selector) {
69 | $(selector)[0]?.dispatchEvent(new CustomEvent('change'))
70 | })
71 |
72 | $(inputSelectors.numberInput)[0]?.dispatchEvent(new CustomEvent('focus'))
73 | $(inputSelectors.numberInput)[0]?.dispatchEvent(new CustomEvent('blur'))
74 | }
75 | }
76 | })
77 |
--------------------------------------------------------------------------------
/Public/js/fixInfiniteLoading.js:
--------------------------------------------------------------------------------
1 | window.jQuery(function ($) {
2 | $(document).ajaxComplete(function (event, xhr, settings) {
3 | jQuery('.blockUI').hide()
4 | })
5 | })
6 |
--------------------------------------------------------------------------------
/Public/js/lknIntegrationRedeForWoocommercePublic.js:
--------------------------------------------------------------------------------
1 | (function ($) {
2 | 'use strict'
3 |
4 | /**
5 | * All of the code for your public-facing JavaScript source
6 | * should reside in this file.
7 | *
8 | * Note: It has been assumed you will write jQuery code here, so the
9 | * $ function reference has been prepared for usage within the scope
10 | * of this function.
11 | *
12 | * This enables you to define handlers, for when the DOM is ready:
13 | *
14 | * $(function() {
15 | *
16 | * });
17 | *
18 | * When the window is loaded:
19 | *
20 | * $( window ).load(function() {
21 | *
22 | * });
23 | *
24 | * ...and/or other possibilities.
25 | *
26 | * Ideally, it is not considered best practise to attach more than a
27 | * single DOM-ready or window-load handler for a particular page.
28 | * Although scripts in the WordPress core, Plugins and Themes may be
29 | * practising this, we should strive to set a better example in our own work.
30 | */
31 | })(jQuery)
32 |
--------------------------------------------------------------------------------
/Public/js/pix/LknIntegrationRedeForWoocommercePix.js:
--------------------------------------------------------------------------------
1 | (function ($) {
2 | 'use strict'
3 |
4 | $(window).on('load', function () {
5 | let firstRequest = true
6 | let time = 30
7 | let attempt = 5
8 | let activeButton = true
9 |
10 | const formatter = new Intl.NumberFormat('pt-BR', {
11 | style: 'currency',
12 | currency: 'BRL'
13 | })
14 |
15 | const apiUrl = wpApiSettings.root + 'redeIntegration/verifyPixRedeStatus'
16 |
17 | $(document).ready(function ($) {
18 | const donationId = $('#donationId').val()
19 |
20 | async function checkPaymentStatus() {
21 | try {
22 | if (attempt !== 0) {
23 | attempt -= 1
24 | }
25 | $('.schedule_text').text(phpVarsPix.nextVerify + ' ' + attempt + '):')
26 | const response = await $.ajax({
27 | url: apiUrl,
28 | type: 'GET',
29 | headers: {
30 | Accept: 'application/json'
31 | },
32 | data: {
33 | donationId
34 | }
35 | })
36 |
37 | if (response === 'Approved' || response === 'Captured') {
38 | const checkPayment = $('.payment_check_button')
39 | const schedule = $('#timer')
40 | const now = new Date()
41 | const formattedDate = now.getFullYear() + '/' +
42 | String(now.getMonth() + 1).padStart(2, '0') + '/' +
43 | String(now.getDate()).padStart(2, '0') + ' ' +
44 | String(now.getHours()).padStart(2, '0') + ':' +
45 | String(now.getMinutes()).padStart(2, '0') + ':' +
46 | String(now.getSeconds()).padStart(2, '0')
47 |
48 | checkPayment.text(formattedDate)
49 | checkPayment.prop('disabled', true).css({ 'background-color': '#D9D9D9', cursor: 'not-allowed' }).removeClass('back_hover_button')
50 | clearInterval(paymentTimer)
51 | schedule.text(phpVarsPix.successPayment).css('font-size', '20px')
52 | const clonedSchedule = schedule.clone()
53 | clonedSchedule.insertAfter('.pix_img')
54 |
55 | $('#copy_container').remove()
56 | $('.pix_img').remove()
57 | return true
58 | }
59 | return false
60 | } catch (error) {
61 | console.error('Error:', error)
62 | return false
63 | }
64 | }
65 |
66 | const paymentTimer = setInterval(function () {
67 | if (firstRequest) {
68 | firstRequest = false
69 | time = 60
70 | activeButton = true
71 | }
72 |
73 | time -= 1
74 |
75 | const schedule = $('#timer')
76 | schedule.text(time + 's')
77 |
78 | if (time === 0) {
79 | if (activeButton) {
80 | const checkPayment = $('.payment_check_button')
81 | checkPayment.prop('disabled', false).css({ 'background-color': '#3A3A3A', cursor: 'pointer' }).addClass('back_hover_button')
82 | activeButton = false
83 |
84 | checkPayment.on('click', async function () {
85 | const now = new Date()
86 |
87 | const formattedDate = now.getFullYear() + '/' +
88 | String(now.getMonth() + 1).padStart(2, '0') + '/' +
89 | String(now.getDate()).padStart(2, '0') + ' ' +
90 | String(now.getHours()).padStart(2, '0') + ':' +
91 | String(now.getMinutes()).padStart(2, '0') + ':' +
92 | String(now.getSeconds()).padStart(2, '0')
93 |
94 | checkPayment.text(formattedDate)
95 | checkPayment.prop('disabled', true).css({ 'background-color': '#D9D9D9', cursor: 'not-allowed' }).removeClass('back_hover_button')
96 | const result = await checkPaymentStatus()
97 | if (attempt !== 0) {
98 | time = 30
99 | } else {
100 | time = 0
101 | clearInterval(paymentTimer)
102 | if (result === false) {
103 | schedule.text('MAX')
104 | }
105 | }
106 | if (result === false) {
107 | setTimeout(function () {
108 | checkPayment.prop('disabled', false)
109 | .css({
110 | 'background-color': '#3A3A3A',
111 | cursor: 'pointer'
112 | }).addClass('back_hover_button')
113 |
114 | checkPayment.text(phpVarsPix.pixButton)
115 | }, 7000)
116 | }
117 | })
118 | }
119 | checkPaymentStatus()
120 | if (attempt !== 0) {
121 | time = 30
122 | } else {
123 | time = 0
124 | clearInterval(paymentTimer)
125 | schedule.text('MAX')
126 | }
127 | }
128 | }, 1000)
129 | })
130 |
131 | const shareButton = $('.share_button')
132 |
133 | shareButton.on('click', function () {
134 | const pixLink2 = $('.input_copy_code')
135 | if (navigator.share) {
136 | navigator.share({
137 | title: phpVarsPix.shareTitle,
138 | text: pixLink2.val()
139 | })
140 | } else {
141 | alert(phpVarsPix.shareError)
142 | }
143 | })
144 |
145 | const copyLink = $('.button_copy_code')
146 |
147 | copyLink.on('click', function () {
148 | const pixLink = $('.input_copy_code')
149 |
150 | navigator.clipboard.writeText(pixLink.val())
151 | copyLink.text(phpVarsPix.copied)
152 | copyLink.prop('disabled', true).css({ 'background-color': '#28a428', cursor: 'not-allowed' })
153 |
154 | setTimeout(function () {
155 | copyLink.prop('disabled', false)
156 | .css({
157 | 'background-color': '#3A3A3A',
158 | cursor: 'pointer'
159 | })
160 |
161 | copyLink.text(phpVarsPix.copy)
162 | }, 3000)
163 | })
164 | })
165 |
166 | // eslint-disable-next-line no-undef
167 | })(jQuery)
168 |
--------------------------------------------------------------------------------
/Public/js/pix/LknIntegrationRedeForWoocommercePixRede.js:
--------------------------------------------------------------------------------
1 | const settingsIntegrationRedePix = window.wc.wcSettings.getSetting('integration_rede_pix_data', {})
2 | const labelIntegrationRedePix = window.wp.htmlEntities.decodeEntities(settingsIntegrationRedePix.title)
3 | const ContentIntegrationRedePix = props => {
4 | return /* #__PURE__ */React.createElement('div', {
5 | class: 'LknIntegrationRedeForWoocommercePaymentFields'
6 | }, /* #__PURE__ */React.createElement('p', null, settingsIntegrationRedePix.description), /* #__PURE__ */React.createElement('svg', {
7 | id: 'integration-logo-rede',
8 | xmlns: 'http://www.w3.org/2000/svg',
9 | viewBox: '0 0 480.72 156.96'
10 | }, /* #__PURE__ */React.createElement('title', null, 'logo-rede'), /* #__PURE__ */React.createElement('path', {
11 | style: {
12 | fill: '#ff7800'
13 | },
14 | class: 'cls-1',
15 | d: 'M475.56 98.71h-106c-15.45 0-22-6-24.67-14.05h33.41c22.33 0 36.08-9.84 36.08-31.08S400.6 21.4 378.27 21.4h-10.62c-20 0-44.34 11.64-49.45 39.51h-29.89V0H263v60.91h-31.23c-29.94.15-46.61 15.31-48.79 37.8h-52.26c-15.45 0-22-6-24.67-14.05h33.41c22.33 0 36.08-9.84 36.08-31.08S161.8 21.4 139.47 21.4h-10.62c-20 0-44.34 11.64-49.45 39.51H57.47c-13.74 0-25.93 4.22-32.64 12.5V62.78H0v87.62c0 5 1.56 6.56 6.4 6.56h12.5c4.68 0 6.4-1.56 6.4-6.56v-34.51c0-26.08 16.4-31.24 33.27-31.24h21.06c5.26 25.88 26.93 38.26 52 38.26h54.48c6.26 15 21.21 22.8 45.17 22.8h14.52c23.74 0 43.73-16.87 43.73-41.7V84.65h28.87c5.26 25.88 26.93 38.26 52 38.26h105.16a5.23 5.23 0 0 0 5.15-5.31v-13.9a5.07 5.07 0 0 0-5.15-4.99zM127.91 45.14h12.34c5.62 0 9.53 2.34 9.53 8 0 5.31-3.9 7.81-9.53 7.81h-34.9c2.07-8.84 7.88-15.81 22.56-15.81zM263 104.8c0 9.84-7.49 16.87-17.18 16.87h-16.24c-13.12 0-21.71-5.15-21.71-18.12 0-12.65 8.59-18.9 21.71-18.9H263v20.15zm103.71-59.66H379c5.62 0 9.53 2.34 9.53 8 0 5.31-3.9 7.81-9.53 7.81h-34.9c2.12-8.84 7.9-15.81 22.61-15.81z'
16 | })))
17 | }
18 | const BlockGatewayIntegrationRedePix = {
19 | name: 'integration_rede_pix',
20 | label: labelIntegrationRedePix,
21 | content: window.wp.element.createElement(ContentIntegrationRedePix),
22 | edit: window.wp.element.createElement(ContentIntegrationRedePix),
23 | canMakePayment: () => true,
24 | ariaLabel: labelIntegrationRedePix,
25 | supports: {
26 | features: settingsIntegrationRedePix.supports
27 | }
28 | }
29 | window.wc.wcBlocksRegistry.registerPaymentMethod(BlockGatewayIntegrationRedePix)
30 |
--------------------------------------------------------------------------------
/Public/partials/lkn-integration-rede-for-woocommerce-public-display.php:
--------------------------------------------------------------------------------
1 |
15 |
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Integration Rede for WooCommerce
2 |
3 | [Integration Rede for WooCommerce](https://www.linknacional.com.br/wordpress/woocommerce/rede/) is a plugin designed to seamlessly integrate Rede or Maxipago into your WooCommerce store, enabling your customers to make payments using credit or debit cards.
4 |
5 | Plugin at WordPress marketplace
6 | https://wordpress.org/plugins/woo-rede/
7 |
8 | ## Dependencies
9 |
10 | Integration Rede for WooCommerce plugin is dependent on WooCommerce plugin, please make sure WooCommerce is installed and properly configured before starting Integration Rede for WooCommerce installation.
11 |
12 | ## Installation
13 |
14 | 1) Navigate to the WordPress plugins area in the sidebar.
15 |
16 | 2) Click on 'add new' and upload the integration-rede-for-woocommerce-master.zip plugin.
17 |
18 | 3) Install and activate the plugin.
19 |
20 | Integration Rede for WooCommerce is now active and ready to use.
21 |
22 | ## Usage
23 |
24 | ### Payments Settings
25 |
26 | 1) Access WooCommerce settings from the WordPress admin dashboard.
27 |
28 | 2) Under "Payments", locate "Rede" or "Maxipago" and configure settings.
29 |
30 | 3) Enter required configuration information such as PV and Token for Rede or Merchant ID and Merchant Key for Maxipago.
31 |
32 | 4) Activate each payment method after configuration.
33 |
34 | ## Development notes
35 |
36 | This version of the **Integration Rede for WooCommerce** plugin was developed without any encouragement from Rede. This means that none of the developers of this plugin have any bonds with the Rede and we count on your help to improve the code and operation of this plugin.
37 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "lkn/integration-rede-for-woocommerce",
3 | "type": "project",
4 | "license": "Proprietary",
5 | "autoload": {
6 | "psr-4": {
7 | "Lkn\\IntegrationRedeForWoocommerce\\Includes\\": "Includes/",
8 | "Lkn\\IntegrationRedeForWoocommerce\\Admin\\": "Admin/",
9 | "Lkn\\IntegrationRedeForWoocommerce\\PublicView\\": "Public/"
10 | }
11 | },
12 | "authors": [
13 | {
14 | "name": "Link Nacional",
15 | "email": "ticket@linknacional.com"
16 | }
17 | ],
18 | "minimum-stability": "stable",
19 | "require-dev": {
20 | "phan/phan": "5.4.1"
21 | },
22 | "require": {
23 | "developersrede/erede-php": "5.1.3",
24 | "monolog/monolog": "2.9.2"
25 | },
26 | "config": {
27 | "allow-plugins": {
28 | "composer/installers": true
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 | run();
80 | }
81 | run_LknIntegrationRedeForWoocommerce();
82 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "docker-php-dev-container",
3 | "version": "1.0.0",
4 | "description": "This repository provides a development environment for WHMCS or WordPress",
5 | "repository": {
6 | "type": "git",
7 | "url": "git+https://github.com/srbrunoferreira/docker-php-dev-container.git"
8 | },
9 | "keywords": [
10 | "WordPress",
11 | "WHMCS",
12 | "plugin",
13 | "Dev Container",
14 | "VS Code"
15 | ],
16 | "author": "Bruno Ferreira ",
17 | "license": "MIT",
18 | "bugs": {
19 | "url": "https://github.com/srbrunoferreira/docker-php-dev-container/issues"
20 | },
21 | "homepage": "https://github.com/srbrunoferreira/docker-php-dev-container#readme",
22 | "devDependencies": {
23 | "@babel/core": "^7.26.0",
24 | "@babel/preset-env": "^7.26.0",
25 | "@babel/preset-react": "^7.25.9",
26 | "babel-loader": "^9.2.1",
27 | "css-loader": "^7.1.2",
28 | "eslint": "^8.34.0",
29 | "eslint-config-airbnb-base": "^15.0.0",
30 | "eslint-config-standard": "^17.0.0",
31 | "eslint-plugin-import": "^2.27.5",
32 | "eslint-plugin-n": "^15.6.1",
33 | "eslint-plugin-promise": "^6.1.1",
34 | "style-loader": "^4.0.0",
35 | "webpack-cli": "^5.1.4"
36 | },
37 | "dependencies": {
38 | "react-credit-cards": "^0.8.3"
39 | },
40 | "scripts": {
41 | "build": "webpack"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/uninstall.php:
--------------------------------------------------------------------------------
1 | {
13 | const name = pathData.chunk.name;
14 | const entryPath = module.exports.entry[name];
15 | const baseName = path.basename(entryPath, '.js');
16 | return entryPath.replace(baseName, `${baseName}Compiled`);
17 | },
18 | path: path.resolve(__dirname)
19 | },
20 | module: {
21 | rules: [
22 | {
23 | test: /\.js$/,
24 | exclude: /node_modules/,
25 | use: {
26 | loader: 'babel-loader',
27 | options: {
28 | presets: ['@babel/preset-env', '@babel/preset-react']
29 | }
30 | }
31 | },
32 | {
33 | test: /\.css$/,
34 | use: ['style-loader', 'css-loader']
35 | }
36 | ]
37 | }
38 | };
--------------------------------------------------------------------------------