Skip to content

Commit

Permalink
fix: adiciona validação quando o CEP é somente zeros (#203)
Browse files Browse the repository at this point in the history
* fix: add validation

* fix: update versions
  • Loading branch information
JoaoPedro0000 authored Nov 6, 2024
1 parent 678fca1 commit 6e2f5bb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Models/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

class Version {

const VERSION = '2.15.8';
const VERSION = '2.15.9';
}
8 changes: 8 additions & 0 deletions Services/PayloadService.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ public function validatePayload( $payload ) {
return false;
}

if ($from == '00000000') {
return false;
}

if ( empty( $payload->to ) || empty( $payload->to->postal_code ) ) {
return false;
}
Expand All @@ -206,6 +210,10 @@ public function validatePayload( $payload ) {
return false;
}

if ($to == '00000000') {
return false;
}

if ( empty( $payload->options ) ) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions melhor-envio-beta.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
Plugin Name: Melhor Envio
Plugin URI: https://melhorenvio.com.br
Description: Plugin para cotação e compra de fretes utilizando a API da Melhor Envio.
Version: 2.15.8
Version: 2.15.9
Author: Melhor Envio
Author URI: melhorenvio.com.br
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: melhor-envio
Requires Plugins: woocommerce, woocommerce-extra-checkout-fields-for-brazil
Tested up to: 6.5
Tested up to: 6.6
Requires PHP: 7.2
WC requires at least: 4.0
WC tested up to: 8.8
Expand Down
10 changes: 7 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
=== Melhor Envio ===
Version: 2.15.8
Version: 2.15.9
Tags: frete, fretes, cotação, cotações, correios, envio, jadlog, latam latam cargo, azul, azul cargo express, melhor envio
Requires at least: 4.7
Tested up to: 6.5
Stable tag: 2.15.8
Tested up to: 6.6
Stable tag: 2.15.9
Requires PHP: 7.2+
Requires Wordpress 4.0+
Requires WooCommerce 4.0+
Expand Down Expand Up @@ -68,6 +68,10 @@ Observação: Atenção com as medidas de unidades utilizadas, cuidado se você
Pronto! o plugin do Melhor Envio está funcionando.

== Changelog ==
= 2.15.9 =
* Adiciona validacao quando o cep é somente zeros.
* Atualiza versão compativel do wordpress.

= 2.15.8 =
* Adiciona log no caso de falha em uma requisição.
* Corrige cotacao em compras com produtos virtuais.
Expand Down

0 comments on commit 6e2f5bb

Please sign in to comment.