Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #81 from gabriellucius/list-transactions
Browse files Browse the repository at this point in the history
List transactions
  • Loading branch information
s2it-moscou committed Mar 20, 2018
2 parents 610c635 + 45d83c3 commit f3204f1
Show file tree
Hide file tree
Showing 15 changed files with 1,508 additions and 3 deletions.
209 changes: 209 additions & 0 deletions app/code/community/UOL/PagSeguro/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,4 +602,213 @@ public function formatDocument($document)
break;
}
}

/**
* @param $type
*
* @return bool|string
*/
public function getTitleTypePaymentMethod($type)
{
if (!is_null($type)) {
switch ($type) {
case 1:
return $this->__('Cartão de crédito');
break;
case 2:
return $this->__('Boleto');
break;
case 3:
return $this->__('Débito online(TEF)');
break;
case 4:
return $this->__('Saldo PagSeguro');
break;
case 7:
return $this->__('Depósito em conta');
break;
default:
return $type;
break;
}
}

return false;
}

/**
* @param $code
*
* @return bool|string
*/
public function getTitleCodePaymentMethod($code)
{
if (!is_null($code)) {
switch ($code) {
case 101:
return $this->__('Cartão de crédito Visa');
break;
case 102:
return $this->__('Cartão de crédito MasterCard');
break;
case 103:
return $this->__('Cartão de crédito American Express');
break;
case 104:
return $this->__('Cartão de crédito Diners');
break;
case 105:
return $this->__('Cartão de crédito Hipercard');
break;
case 106:
return $this->__('Cartão de crédito Aura');
break;
case 107:
return $this->__('Cartão de crédito Elo');
break;
case 109:
return $this->__('Cartão de crédito PersonalCard');
break;
case 112:
return $this->__('Cartão de crédito BrasilCard');
break;
case 113:
return $this->__('Cartão de crédito FORTBRASIL');
break;
case 115:
return $this->__('Cartão de crédito VALECARD');
break;
case 116:
return $this->__('Cartão de crédito Cabal');
break;
case 117:
return $this->__('Cartão de crédito Mais!');
break;
case 119:
return $this->__('Cartão de crédito GRANDCARD');
break;
case 120:
return $this->__('Cartão de crédito Sorocred');
break;
case 122:
return $this->__('Cartão de crédito Up Policard');
break;
case 123:
return $this->__('Cartão de crédito Banese Card');
break;
case 201:
return $this->__('Boleto Bradesco');
break;
case 202:
return $this->__('Boleto Santander');
break;
case 301:
return $this->__('Débito online Bradesco');
break;
case 302:
return $this->__('Débito online Itaú');
break;
case 304:
return $this->__('Débito online Banco do Brasil');
break;
case 306:
return $this->__('Débito online Banrisul');
break;
case 401:
return $this->__('Saldo PagSeguro');
break;
case 701:
return $this->__('Depósito em conta - Banco do Brasil');
break;
default:
return $code;
break;
}
}

return false;
}

/**
* @param $type
*
* @return bool|string
*/
public function getTitleCancellationSourceTransaction($cancellationSource)
{
if (!is_null($cancellationSource)) {
switch ($cancellationSource) {
case "INTERNAL":
return $this->__('PagSeguro');
break;
case "EXTERNAL":
return $this->__('Instituições Financeiras');
break;
default:
return $cancellationSource;
break;
}
}

return false;
}

/**
* Translates the transation type code to his respective name, according with the api
*
* @param int $transactionTypeCode
* @return mixed string | int
*/
public function getTransactionTypeName($transactionTypeCode)
{
if ($transactionTypeCode) {
switch ($transactionTypeCode) {
case 1:
return $this->__('Venda');
break;
case 2:
return $this->__('Transferência');
break;
case 3:
return $this->__('Adição de fundos');
break;
case 4:
return $this->__('Saque');
break;
case 5:
return $this->__('Cobrança');
break;
case 6:
return $this->__('Doação');
break;
case 7:
return $this->__('Bônus');
break;
case 8:
return $this->__('Repasse de bônus');
break;
case 9:
return $this->__('Operacional');
break;
case 10:
return $this->__('Doação pública');
break;
case 11:
return $this->__('Pagamento pré aprovado');
break;
case 12:
return $this->__('Campanha bônus');
break;
case 13:
return $this->__('Secundária');
break;
case 14:
return $this->__('Validador');
break;
default:
return $transactionTypeCode;
break;
}
}
}
}
38 changes: 38 additions & 0 deletions app/code/community/UOL/PagSeguro/Helper/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,42 @@ public function setUpdateOrderLog($class, $orderId, $transactionCode, $orderStat
$phrase .= "'orderStatus' => '".$orderStatus."'\n ) )";
$this->setLog($phrase, $this->setModule($class));
}

/**
* @param $class
* @param $parametros
*/
public function setSearchListTransactionLog($class, $params)
{
$phrase = "Search(";

$filters = array();
if(isset($params['idMagento'])){
$filters[] = "idMagento = ".$params['idMagento'];
}

if(isset($params['idPagSeguro'])){
$filters[] = "idPagSeguro = '".$params['idPagSeguro']."'";
}

if(isset($params['environment'])){
$filters[] = "environment = '".$params['environment']."'";
}

if(isset($params['startDate']) && isset($params['endDate'])){
$filters[] = "range of dates = '".$params['startDate']." until ".$params['endDate']."'";
}

if(isset($params['status'])){
$filters[] = "status = '".$params['status']."'";
}

if(count($filters) > 0){
$phrase .= implode(' | ', $filters);
}

$phrase .= ")";
$this->setLog($phrase, $this->setModule($class));
}

}
Loading

0 comments on commit f3204f1

Please sign in to comment.