diff --git a/assets/js/scripts-cartao.js b/assets/js/scripts-cartao.js
index 97321fe..95215d0 100755
--- a/assets/js/scripts-cartao.js
+++ b/assets/js/scripts-cartao.js
@@ -1,6 +1,6 @@
jQuery(document).ready(function ($) {
- if(!document.getElementById('swalCss')){
+ if (!document.getElementById('swalCss')) {
let swalCss = $("").html(".colored-toast .swal2-title {color: white;}.colored-toast .swal2-close {color: white;}.colored-toast .swal2-html-container {color: white;}.colored-toast.swal2-icon-error {background-color: #f27474 !important;}")
$("#payment").after(swalCss);
}
@@ -58,7 +58,8 @@ jQuery(document).ready(function ($) {
// Buscar Parcelas
jQuery("#gn_cartao_number").keyup(function () {
- let total = document.querySelector("#order_review > table > tfoot > tr.order-total > td > strong > span > bdi").innerHTML.replace('R$', '').replaceAll(',', '').replaceAll('.', '').replaceAll(' ', '');
+ let total = document.querySelector("#gn_payment_total").value;
+ total = parseInt(total.replace('.', ''));
console.log(total);
if (jQuery("#gn_cartao_number").val().length >= 19) {
@@ -312,7 +313,7 @@ jQuery(document).ready(function ($) {
if (msg == 'Error: O total fornecido é superior ao limite máximo por transação.')
msg = 'O valor total da compra é superior ao limite para emissão.'
- if(msg.toString().includes('Identificador de conta'))
+ if (msg.toString().includes('Identificador de conta'))
msg = 'Identificador de Conta inválido. Entre em contato com o administrador da loja.'
if (msg != null && msg != '') {
diff --git a/gerencianet-oficial.php b/gerencianet-oficial.php
index 61dd74a..a1792ef 100755
--- a/gerencianet-oficial.php
+++ b/gerencianet-oficial.php
@@ -9,7 +9,7 @@
* Plugin Name: Efí by Gerencianet Oficial
* Plugin URI: https://wordpress.org/plugins/woo-gerencianet-official/
* Description: Gateway de pagamento Efi by Gerencianet para WooCommerce
- * Version: 2.0.11
+ * Version: 2.0.12
* Author: Efi by Gerencianet
* Author URI: https://www.sejaefi.com.br
* License: GPL-2.0+
@@ -25,7 +25,7 @@
die;
}
-define( 'GERENCIANET_OFICIAL_VERSION', '2.0.11' );
+define( 'GERENCIANET_OFICIAL_VERSION', '2.0.12' );
define( 'GERENCIANET_BOLETO_ID', 'WC_Gerencianet_Boleto' );
define( 'GERENCIANET_CARTAO_ID', 'WC_Gerencianet_Cartao' );
define( 'GERENCIANET_PIX_ID', 'WC_Gerencianet_Pix' );
diff --git a/includes/lib/gerencianet/gerencianet/gerencianet-sdk-php/src/Gerencianet/Request.php b/includes/lib/gerencianet/gerencianet/gerencianet-sdk-php/src/Gerencianet/Request.php
index 5b46c0d..98918c6 100755
--- a/includes/lib/gerencianet/gerencianet/gerencianet-sdk-php/src/Gerencianet/Request.php
+++ b/includes/lib/gerencianet/gerencianet/gerencianet-sdk-php/src/Gerencianet/Request.php
@@ -27,7 +27,7 @@ public function __construct(array $options = null)
'headers' => [
'Content-Type' => 'application/json',
'api-sdk' => 'php-' . $composerData['version'],
- 'wordpress-plugin' => 'v2.0.11', // ATUALIZAR VERSÃO A CADA ATUALIZAÇÃO
+ 'wordpress-plugin' => 'v2.0.12', // ATUALIZAR VERSÃO A CADA ATUALIZAÇÃO
'partner-token' => $partner_token
]
];
diff --git a/includes/payment-methods/class-wc-gerencianet-boleto.php b/includes/payment-methods/class-wc-gerencianet-boleto.php
index 3bbd1b3..690592d 100755
--- a/includes/payment-methods/class-wc-gerencianet-boleto.php
+++ b/includes/payment-methods/class-wc-gerencianet-boleto.php
@@ -155,6 +155,11 @@ public function init_form_fields() {
);
}
+ public function gn_price_format($value){
+ $value = number_format($value, 2, "", "");
+ return $value;
+ }
+
public function payment_fields() {
if ( $this->description ) {
echo wpautop( wp_kses_post( $this->description ) );
@@ -234,23 +239,23 @@ public function process_payment( $order_id ) {
$newFee = array(
'name' => __( 'Taxas', Gerencianet_I18n::getTextDomain() ),
'amount' => 1,
- 'value' => $item->get_subtotal() * 100,
+ 'value' => (int)$this->gn_price_format($item->get_subtotal()),
);
- $orderTotal += $item->get_subtotal() * 100;
+ $orderTotal += (int)$this->gn_price_format($item->get_subtotal());
$items[] = $newFee;
break;
case 'shipping':
if ( $item->get_total() > 0 ) {
$shipping[] = array(
'name' => __( 'Frete', Gerencianet_I18n::getTextDomain() ),
- 'value' => $item->get_total() * 100,
+ 'value' => (int)$this->gn_price_format($item->get_total()),
);
}
break;
case 'coupon':
$newDiscount = array(
'type' => 'currency',
- 'value' => $item->get_discount() * 100,
+ 'value' => (int)$this->gn_price_format($item->get_discount()),
);
$discount = $newDiscount;
break;
@@ -259,9 +264,9 @@ public function process_payment( $order_id ) {
$newItem = array(
'name' => $product->get_name(),
'amount' => $item->get_quantity(),
- 'value' => $product->get_price() * 100,
+ 'value' => (int)$this->gn_price_format($product->get_price()),
);
- $orderTotal += $product->get_price() * 100 * $item->get_quantity();
+ $orderTotal += (int)$this->gn_price_format($product->get_price() * $item->get_quantity());
$items[] = $newItem;
break;
default:
@@ -269,9 +274,9 @@ public function process_payment( $order_id ) {
$newItem = array(
'name' => $item->get_name(),
'amount' => $item->get_quantity(),
- 'value' => $product->get_price() * 100,
+ 'value' => (int)$this->gn_price_format($product->get_price()),
);
- $orderTotal += $product->get_price() * 100 * $item->get_quantity();
+ $orderTotal += (int)$this->gn_price_format($product->get_price() * $item->get_quantity());
$items[] = $newItem;
break;
}
@@ -281,7 +286,7 @@ public function process_payment( $order_id ) {
$newItem = array(
'name' => 'Taxas',
'amount' => 1,
- 'value' => $order->get_total_tax() * 100,
+ 'value' => (int)$this->gn_price_format($order->get_total_tax())
);
array_push($items, $newItem);
}
diff --git a/includes/payment-methods/class-wc-gerencianet-cartao.php b/includes/payment-methods/class-wc-gerencianet-cartao.php
index cd9455f..67bea16 100755
--- a/includes/payment-methods/class-wc-gerencianet-cartao.php
+++ b/includes/payment-methods/class-wc-gerencianet-cartao.php
@@ -50,6 +50,11 @@ public function __construct() {
add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
}
+ public function gn_price_format($value){
+ $value = number_format($value, 2, "", "");
+ return $value;
+ }
+
public function init_form_fields() {
$this->form_fields = array(
@@ -159,6 +164,7 @@ public function payment_fields() {
+