Skip to content

Commit

Permalink
Merge pull request pagseguro#31 from Thiago-Medeiros/refactor-v2
Browse files Browse the repository at this point in the history
Refactor, improvements & bug fix
  • Loading branch information
s2it-moscou authored Jan 24, 2018
2 parents ac130b9 + 71a8887 commit 4a0202b
Show file tree
Hide file tree
Showing 466 changed files with 6,913 additions and 1,341 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
2.0.0
- move files from woocommerce-pagseguro-oficial folder to root
- update php-lib
- access WC_Order properties by getters
- change all file path's (create a constant relative to root plugin folder)
- test data before send to pagseguro ws
- improvements on lightbox checkout page
- fix pagseguro url's
- fix header bad format

1.4.4
- Correção de bugs no checkout transparente no redirecionamento e botões de pagamento de débito e boleto.
- Correção de bugs na url no checkout lightbox

1.4.0
- Implementado checkout transparente (boleto, debito online e cartão de crédito)

1.3.0
- Implementado conciliação e cancelamento.

1.2.0
- Implementado checkout com lightbox.

1.1.1
- Ajustes em geral

1.1.0
- Ajuste na ativação/desativação do módulo.

1.0.0
- Versão inicial. Integração com API de checkout e API de notificações.
34 changes: 10 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@ Requisitos
Instalação
----------
---
> **ATENÇÃO** caso já possua alguma versão deste plugin instalado siga as intruções de atualização antes de prosseguir
- Certifique-se de que não há instalação de outros módulos para o PagSeguro em seu sistema;
- Baixe o repositório como arquivo zip ou faça um clone;
- Baixe o arquivo [woocommerce-pagseguro-oficial.zip](https://github.com/pagseguro/woocommerce/raw/master/woocommerce-pagseguro-oficial.zip);
- Na área administrativa de seu WordPress acesse o menu Plugins -> Adicionar Novo -> Enviar/Fazer upload do plugin -> aponte para o caminho do arquivo woocommerce-pagseguro-oficial.zip e selecione Instalar Agora;
- Após a instalação selecione *Ativar plugin*;

Atualizando versões <2.x.x
----------
---
- Exclua a pasta do plugin antigo
- Exclua todas as Página Pagseguro e suas sub-páginas
- Prossiga do passo 1 da instalação


Configuração
Expand Down Expand Up @@ -66,29 +74,7 @@ Inputs
Changelog
---------
---
1.4.4
- Correção de bugs no checkout transparente no redirecionamento e botões de pagamento de débito e boleto.
- Correção de bugs na url no checkout lightbox

1.4.0
- Implementado checkout transparente (boleto, debito online e cartão de crédito)

1.3.0
- Implementado conciliação e cancelamento.

1.2.0
- Implementado checkout com lightbox.

1.1.1
- Ajustes em geral

1.1.0

- Ajuste na ativação/desativação do módulo.

1.0.0

- Versão inicial. Integração com API de checkout e API de notificações.
Para consultar o log de alterações acesse o arquivo [CHANGELOG.md](CHANGELOG.md).


Licença
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

require_once('../../../../wp-load.php');

class WC_PagSeguro_Ajax {

class WC_PagSeguro_Ajax
{
/**
* Hook in ajax handlers.
*/
public static function init() {
public static function init()
{
try {
self::is_ajax();
(new WC_PagSeguro_Ajax)->is_ajax();
self::get_payment_service(
self::validate_checkout_type($_REQUEST['checkout_type'])
);
Expand All @@ -18,9 +19,26 @@ public static function init() {
}
}

/**
* Check if is ajax request
*
* @return bool
* @throws WC_PagSeguro_Exception
*/
private function is_ajax()
{
if ((bool)$_GET['wc-pagseguro-ajax'] === true) {
return true;
}

throw new WC_PagSeguro_Exception('Não foi possivel encontrar o parâmetro ajax ou o mesmo não é válido.', 400);
}

/**
* Get direct payment service by name
*
* @param $service_name
*
* @throws WC_PagSeguro_Exception
*/
private static function get_payment_service($service_name)
Expand All @@ -40,30 +58,21 @@ private static function get_payment_service($service_name)
}
}

/**
* Check if is ajax request
* @return bool
* @throws WC_PagSeguro_Exception
*/
private function is_ajax()
{
if ((bool)$_GET['wc-pagseguro-ajax'] === true)
return true;
throw new WC_PagSeguro_Exception('Não foi possivel encontrar o parâmetro ajax ou o mesmo não é válido.', 400);
}

/**
* Check if the checkout type is valid.
*
* @param $type
*
* @return mixed
* @throws WC_PagSeguro_Exception
*/
private static function validate_checkout_type($type)
{
if (isset($type))
if (isset($type)) {
return filter_var($_REQUEST['checkout_type'], FILTER_SANITIZE_STRING);
}
throw new WC_PagSeguro_Exception('O tipo de checkout informado não é valido', 400);
}
}

WC_PagSeguro_Ajax::init();
WC_PagSeguro_Ajax::init();
Loading

0 comments on commit 4a0202b

Please sign in to comment.