Skip to content

Commit

Permalink
Merge pull request #101 from LinkNacional/dev
Browse files Browse the repository at this point in the history
1.11.5 Correção em validação de nonce e alteração em placeholders
  • Loading branch information
emanuellopess authored Oct 11, 2024
2 parents 4b63322 + 248813a commit 18a98dc
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: "1.11.4"
custom_tag: "1.11.5"

# Generate new release
- name: Generate new Release
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.11.5 - 10/10/2024
* Correção em validação de nonce;
* Alteração em placeholders.

# 1.11.4 - 04/10/2024
* Adicionado modo de compatibilidade para validação de nonce;
* Corrigido erro no envio de cartão de crédito inválido.
Expand Down
7 changes: 6 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.linknacional.com.br/wordpress/woocommerce/cielo/
Tags: woocommerce, payment, paymethod, card, credit
Requires at least: 5.7
Tested up to: 6.6
Stable tag: 1.11.4
Stable tag: 1.11.5
Requires PHP: 7.2
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -71,6 +71,11 @@ Payment Gateway for Cielo API on WooCommerce plugin is dependent on WooCommerce
7. Debit card front page with payment fields.

== Changelog ==
= 1.11.5 =
**10/10/2024**
* Fix nonce validation;
* Change placeholders.

= 1.11.4 =
**04/10/2024**
* Added compatibility mode for nonce validation;
Expand Down
14 changes: 7 additions & 7 deletions includes/LknWCGatewayCieloCredit.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ class="nonce_lkn_cielo_credit"
class="lkn-card-num"
maxlength="24"
required
placeholder="<?php echo $placeholderEnabled ? esc_attr('**** **** **** ****') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('**** **** ****') : ''; ?>"
placeholder="<?php echo $placeholderEnabled ? esc_attr('XXXX XXXX XXXX XXXX') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('XXXX XXXX XXXX XXXX') : ''; ?>"
>
</div>
<div class="form-row form-row-wide">
Expand All @@ -357,8 +357,8 @@ class="lkn-card-num"
class="lkn-card-exp"
maxlength="7"
required
placeholder="<?php echo $placeholderEnabled ? esc_attr('**/****') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('**/****') : ''; ?>"
placeholder="<?php echo $placeholderEnabled ? esc_attr('MM/YY') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('MM/YY') : ''; ?>"
>
</div>
<div class="form-row form-row-wide">
Expand All @@ -373,8 +373,8 @@ class="lkn-card-exp"
class="lkn-cvv"
maxlength="8"
required
placeholder="<?php echo $placeholderEnabled ? esc_attr('***') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('***') : ''; ?>"
placeholder="<?php echo $placeholderEnabled ? esc_attr('CVV') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('CVV') : ''; ?>"
>
</div>
<?php
Expand Down Expand Up @@ -469,7 +469,7 @@ public function validate_fields() {
public function process_payment($order_id) {
$nonceInactive = $this->get_option('nonce_compatibility', 'no');

if ( ! wp_verify_nonce($_POST['asdnonce_lkn_cielo_credit'], 'nonce_lkn_cielo_credit') && 'no' === $nonceInactive) {
if ( ! wp_verify_nonce($_POST['nonce_lkn_cielo_credit'], 'nonce_lkn_cielo_credit') && 'no' === $nonceInactive) {
$this->log->log('error', 'Nonce verification failed. Nonce: ' . var_export($_POST['nonce_lkn_cielo_credit'], true), array('source' => 'woocommerce-cielo-credit'));
$this->add_notice_once(__('Nonce verification failed, try reloading the page', 'lkn-wc-gateway-cielo'), 'error');
throw new Exception(esc_attr(__('Nonce verification failed, try reloading the page', 'lkn-wc-gateway-cielo')));
Expand Down
24 changes: 12 additions & 12 deletions includes/LknWCGatewayCieloDebit.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct() {
$this->supports = apply_filters('lkn_wc_cielo_debit_add_support', $this->supports);

$this->method_title = __('Cielo - Debit and credit card', 'lkn-wc-gateway-cielo');
$this->method_description = __('Allows debit and credit card payment with Cielo API 3.0.', 'lkn-wc-gateway-cielo') . '<a href="https://www.linknacional.com.br/wordpress/woocommerce/cielo/#cartao-debito-cielo-configurar" target="_blank">' . __('Learn more how to configure.', 'lkn-wc-gateway-cielo') . '</a>' . '<br><br>' . '<p>' . __('To use the 3DS functionality it is necessary to register for 3DS 2.0 (request to eCommerce Support).', 'lkn-wc-gateway-cielo') . '<a href="https://www.cielo.com.br/atendimento/" target="_blank">' . __('Learn more how to configure.', 'lkn-wc-gateway-cielo') . '</a>' . '<p>';
$this->method_description = __('Allows debit and credit card payment with Cielo API 3.0.', 'lkn-wc-gateway-cielo') . '<a href="https://www.linknacional.com.br/wordpress/woocommerce/cielo/#cartao-debito-cielo-configurar" target="_blank">' . __('Learn more how to configure.', 'lkn-wc-gateway-cielo') . '</a>' . '<br><br>' . '<p>' . __('To use the 3DS functionality it is necessary to register for 3DS 2.2 (request to eCommerce Support).', 'lkn-wc-gateway-cielo') . '<a href="https://www.cielo.com.br/atendimento/" target="_blank">' . __('Learn more how to configure.', 'lkn-wc-gateway-cielo') . '</a>' . '<p>';

// Load the settings.
$this->init_form_fields();
Expand Down Expand Up @@ -189,7 +189,7 @@ public function init_form_fields(): void {
'client_id' => array(
'title' => __('Client Id', 'lkn-wc-gateway-cielo'),
'type' => 'password',
'description' => __('Cielo 3DS 2.0 registration required (ask for eCommerce support).', 'lkn-wc-gateway-cielo'),
'description' => __('Cielo 3DS 2.2 registration required (ask for eCommerce support).', 'lkn-wc-gateway-cielo'),
'desc_tip' => true,
'custom_attributes' => array(
'required' => 'required'
Expand All @@ -198,7 +198,7 @@ public function init_form_fields(): void {
'client_secret' => array(
'title' => __('Client Secret', 'lkn-wc-gateway-cielo'),
'type' => 'password',
'description' => __('Cielo 3DS 2.0 registration required (ask for eCommerce support).', 'lkn-wc-gateway-cielo'),
'description' => __('Cielo 3DS 2.2 registration required (ask for eCommerce support).', 'lkn-wc-gateway-cielo'),
'desc_tip' => true,
'custom_attributes' => array(
'required' => 'required'
Expand Down Expand Up @@ -576,8 +576,8 @@ class="bpmpi_order_productcode"
class="lkn-card-num"
maxlength="24"
required
placeholder="<?php echo $placeholderEnabled ? esc_attr('**** **** **** ****') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('**** **** ****') : ''; ?>"
placeholder="<?php echo $placeholderEnabled ? esc_attr('XXXX XXXX XXXX XXXX') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('XXXX XXXX XXXX XXXX') : ''; ?>"
>
</div>
<div class="form-row form-row-wide">
Expand All @@ -592,8 +592,8 @@ class="lkn-card-num"
class="lkn-card-exp"
maxlength="7"
required
placeholder="<?php echo $placeholderEnabled ? esc_attr('**/****') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('**/****') : ''; ?>"
placeholder="<?php echo $placeholderEnabled ? esc_attr('MM/YY') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('MM/YY') : ''; ?>"
>
</div>
<div class="form-row form-row-wide">
Expand All @@ -609,8 +609,8 @@ class="lkn-card-exp"
class="lkn-cvv"
maxlength="4"
required
placeholder="<?php echo $placeholderEnabled ? esc_attr('***') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('***') : ''; ?>"
placeholder="<?php echo $placeholderEnabled ? esc_attr('CVV') : ''; ?>"
data-placeholder="<?php echo $placeholderEnabled ? esc_attr('CVV') : ''; ?>"
>
</div>
<div class="form-row form-row-wide">
Expand Down Expand Up @@ -800,7 +800,7 @@ public function process_payment($order_id) {
throw new Exception(esc_attr($message));
}
if (empty($eci)) {
$message = __('Invalid Cielo 3DS 2.0 authentication.', 'lkn-wc-gateway-cielo');
$message = __('Invalid Cielo 3DS 2.2 authentication.', 'lkn-wc-gateway-cielo');

throw new Exception(esc_attr($message));
}
Expand Down Expand Up @@ -883,12 +883,12 @@ public function process_payment($order_id) {
$args['body'] = wp_json_encode($body);
} else {
if (empty($cavv)) {
$message = __('Invalid Cielo 3DS 2.0 authentication.', 'lkn-wc-gateway-cielo');
$message = __('Invalid Cielo 3DS 2.2 authentication.', 'lkn-wc-gateway-cielo');

throw new Exception(esc_attr($message));
}
if (empty($xid)) {
$message = __('Invalid Cielo 3DS 2.0 authentication.', 'lkn-wc-gateway-cielo');
$message = __('Invalid Cielo 3DS 2.2 authentication.', 'lkn-wc-gateway-cielo');

throw new Exception(esc_attr($message));
}
Expand Down
4 changes: 2 additions & 2 deletions languages/lkn-wc-gateway-cielo-pt_BR-lkn-dc-script.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"Authentication disabled by the store": [
"Autenticação desabilitada pela loja"
],
"Error in the 3DS 2.0 authentication process check that your credentials are filled in correctly": [
"Erro no processo de autenticação 3DS 2.0 verifique se suas credenciais estão corretas"
"Error in the 3DS 2.2 authentication process check that your credentials are filled in correctly": [
"Erro no processo de autenticação 3DS 2.2 verifique se suas credenciais estão corretas"
],
"Provider not supported by Cielo 3DS authentication": [
"Bandeira não suportada pela autenticação 3DS da Cielo"
Expand Down
12 changes: 6 additions & 6 deletions languages/lkn-wc-gateway-cielo-pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ msgstr "Cielo - Cartão de crédito"
msgid "Please contact Cielo for further assistance."
msgstr "Por favor, entre em contato com a Cielo para mais assistência."

msgid "To use the 3DS functionality it is necessary to register for 3DS 2.0 (request to eCommerce Support)."
msgstr "Para utilizar a funcionalidade 3DS é necessário ter o cadastro de 3DS 2.0 (solicitar para o Suporte eCommerce)."
msgid "To use the 3DS functionality it is necessary to register for 3DS 2.2 (request to eCommerce Support)."
msgstr "Para utilizar a funcionalidade 3DS é necessário ter o cadastro de 3DS 2.2 (solicitar para o Suporte eCommerce)."

msgid "Allows credit card payment with Cielo API 3.0."
msgstr "Permite pagamentos com cartão de crédito através da Cielo API 3.0"
Expand Down Expand Up @@ -113,8 +113,8 @@ msgstr "Permite pagamentos com cartão de débito e crédito através da Cielo A
msgid "Learn more how to configure."
msgstr "Saiba mais sobre como configurar."

msgid "Cielo 3DS 2.0 registration required (ask for eCommerce support)."
msgstr "Necessário cadastro de Cielo 3DS 2.0 (solicitar para o suporte ecommerce)"
msgid "Cielo 3DS 2.2 registration required (ask for eCommerce support)."
msgstr "Necessário cadastro de Cielo 3DS 2.2 (solicitar para o suporte ecommerce)"

msgid "Client Id"
msgstr "Client Id"
Expand Down Expand Up @@ -257,8 +257,8 @@ msgstr "Pagamento de pedido falhou. Quantidade de parcelas inválida."
msgid "Invalid Cielo API 3.0 credentials."
msgstr "Credenciais da Cielo API 3.0 inválidas."

msgid "Invalid Cielo 3DS 2.0 authentication."
msgstr "Autenticação Cielo 3DS 2.0 inválida."
msgid "Invalid Cielo 3DS 2.2 authentication."
msgstr "Autenticação Cielo 3DS 2.2 inválida."

msgid "Installment"
msgstr "Parcelamento"
Expand Down
6 changes: 3 additions & 3 deletions languages/lkn-wc-gateway-cielo.pot
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ msgstr ""
msgid "Please contact Cielo for further assistance."
msgstr ""

msgid "To use the 3DS functionality it is necessary to register for 3DS 2.0 (request to eCommerce Support)."
msgid "To use the 3DS functionality it is necessary to register for 3DS 2.2 (request to eCommerce Support)."
msgstr ""

msgid "Allows credit card payment with Cielo API 3.0."
Expand Down Expand Up @@ -113,7 +113,7 @@ msgstr ""
msgid "Learn more how to configure."
msgstr ""

msgid "Cielo 3DS 2.0 registration required (ask for eCommerce support)."
msgid "Cielo 3DS 2.2 registration required (ask for eCommerce support)."
msgstr ""

msgid "Client Id"
Expand Down Expand Up @@ -257,7 +257,7 @@ msgstr ""
msgid "Invalid Cielo API 3.0 credentials."
msgstr ""

msgid "Invalid Cielo 3DS 2.0 authentication."
msgid "Invalid Cielo 3DS 2.2 authentication."
msgstr ""

msgid "Installment"
Expand Down
4 changes: 2 additions & 2 deletions lkn-wc-gateway-cielo.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://www.linknacional.com.br/wordpress/woocommerce/cielo/
* Description: Adds the Cielo API 3.0 Payments gateway to your WooCommerce website.
*
* Version: 1.11.4
* Version: 1.11.5
*
* Author: Link Nacional
* Author URI: https://linknacional.com.br
Expand Down Expand Up @@ -311,7 +311,7 @@ public static function email_order_meta_fields($fields, $sent_to_admin, $order)
private static function setup_constants(): void {
// Defines addon version number for easy reference.
if ( ! defined('LKN_WC_CIELO_VERSION')) {
define('LKN_WC_CIELO_VERSION', '1.11.4');
define('LKN_WC_CIELO_VERSION', '1.11.5');
}
if ( ! defined('LKN_WC_CIELO_TRANSLATION_PATH')) {
define('LKN_WC_CIELO_TRANSLATION_PATH', plugin_dir_path(__FILE__) . 'languages/');
Expand Down
2 changes: 1 addition & 1 deletion resources/js/debitCard/lkn-dc-script-prd.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function bpmpi_config () {
},
onError: function (e) {
// Error on proccess in authentication
alert(__('Error in the 3DS 2.0 authentication process check that your credentials are filled in correctly', 'lkn-wc-gateway-cielo'))
alert(__('Error in the 3DS 2.2 authentication process check that your credentials are filled in correctly', 'lkn-wc-gateway-cielo'))
},
onUnsupportedBrand: function (e) {
// Provider not supported for authentication
Expand Down
2 changes: 1 addition & 1 deletion resources/js/debitCard/lkn-dc-script-sdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function bpmpi_config () {
},
onError: function (e) {
// Error on proccess in authentication
alert(__('Error in the 3DS 2.0 authentication process check that your credentials are filled in correctly', 'lkn-wc-gateway-cielo'))
alert(__('Error in the 3DS 2.2 authentication process check that your credentials are filled in correctly', 'lkn-wc-gateway-cielo'))
},
onUnsupportedBrand: function (e) {
// Provider not supported for authentication
Expand Down
2 changes: 1 addition & 1 deletion resources/js/frontend/lkn-dc-script-prd.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function bpmpi_config () {

const lknDebitCCForm = document.getElementById('wc-lkn_cielo_debit-cc-form')
if (lknDebitCCForm) {
alert(__('Error in the 3DS 2.0 authentication process check that your credentials are filled in correctly', 'lkn-wc-gateway-cielo'))
alert(__('Error in the 3DS 2.2 authentication process check that your credentials are filled in correctly', 'lkn-wc-gateway-cielo'))
}
},
onUnsupportedBrand: function (e) {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/frontend/lkn-dc-script-sdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function bpmpi_config () {

const lknDebitCCForm = document.getElementById('wc-lkn_cielo_debit-cc-form')
if (lknDebitCCForm) {
alert(__('Error in the 3DS 2.0 authentication process check that your credentials are filled in correctly', 'lkn-wc-gateway-cielo'))
alert(__('Error in the 3DS 2.2 authentication process check that your credentials are filled in correctly', 'lkn-wc-gateway-cielo'))
}
},
onUnsupportedBrand: function (e) {
Expand Down

0 comments on commit 18a98dc

Please sign in to comment.