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

Commit f3204f1

Browse files
authored
Merge pull request #81 from gabriellucius/list-transactions
List transactions
2 parents 610c635 + 45d83c3 commit f3204f1

File tree

15 files changed

+1508
-3
lines changed

15 files changed

+1508
-3
lines changed

app/code/community/UOL/PagSeguro/Helper/Data.php

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,4 +602,213 @@ public function formatDocument($document)
602602
break;
603603
}
604604
}
605+
606+
/**
607+
* @param $type
608+
*
609+
* @return bool|string
610+
*/
611+
public function getTitleTypePaymentMethod($type)
612+
{
613+
if (!is_null($type)) {
614+
switch ($type) {
615+
case 1:
616+
return $this->__('Cartão de crédito');
617+
break;
618+
case 2:
619+
return $this->__('Boleto');
620+
break;
621+
case 3:
622+
return $this->__('Débito online(TEF)');
623+
break;
624+
case 4:
625+
return $this->__('Saldo PagSeguro');
626+
break;
627+
case 7:
628+
return $this->__('Depósito em conta');
629+
break;
630+
default:
631+
return $type;
632+
break;
633+
}
634+
}
635+
636+
return false;
637+
}
638+
639+
/**
640+
* @param $code
641+
*
642+
* @return bool|string
643+
*/
644+
public function getTitleCodePaymentMethod($code)
645+
{
646+
if (!is_null($code)) {
647+
switch ($code) {
648+
case 101:
649+
return $this->__('Cartão de crédito Visa');
650+
break;
651+
case 102:
652+
return $this->__('Cartão de crédito MasterCard');
653+
break;
654+
case 103:
655+
return $this->__('Cartão de crédito American Express');
656+
break;
657+
case 104:
658+
return $this->__('Cartão de crédito Diners');
659+
break;
660+
case 105:
661+
return $this->__('Cartão de crédito Hipercard');
662+
break;
663+
case 106:
664+
return $this->__('Cartão de crédito Aura');
665+
break;
666+
case 107:
667+
return $this->__('Cartão de crédito Elo');
668+
break;
669+
case 109:
670+
return $this->__('Cartão de crédito PersonalCard');
671+
break;
672+
case 112:
673+
return $this->__('Cartão de crédito BrasilCard');
674+
break;
675+
case 113:
676+
return $this->__('Cartão de crédito FORTBRASIL');
677+
break;
678+
case 115:
679+
return $this->__('Cartão de crédito VALECARD');
680+
break;
681+
case 116:
682+
return $this->__('Cartão de crédito Cabal');
683+
break;
684+
case 117:
685+
return $this->__('Cartão de crédito Mais!');
686+
break;
687+
case 119:
688+
return $this->__('Cartão de crédito GRANDCARD');
689+
break;
690+
case 120:
691+
return $this->__('Cartão de crédito Sorocred');
692+
break;
693+
case 122:
694+
return $this->__('Cartão de crédito Up Policard');
695+
break;
696+
case 123:
697+
return $this->__('Cartão de crédito Banese Card');
698+
break;
699+
case 201:
700+
return $this->__('Boleto Bradesco');
701+
break;
702+
case 202:
703+
return $this->__('Boleto Santander');
704+
break;
705+
case 301:
706+
return $this->__('Débito online Bradesco');
707+
break;
708+
case 302:
709+
return $this->__('Débito online Itaú');
710+
break;
711+
case 304:
712+
return $this->__('Débito online Banco do Brasil');
713+
break;
714+
case 306:
715+
return $this->__('Débito online Banrisul');
716+
break;
717+
case 401:
718+
return $this->__('Saldo PagSeguro');
719+
break;
720+
case 701:
721+
return $this->__('Depósito em conta - Banco do Brasil');
722+
break;
723+
default:
724+
return $code;
725+
break;
726+
}
727+
}
728+
729+
return false;
730+
}
731+
732+
/**
733+
* @param $type
734+
*
735+
* @return bool|string
736+
*/
737+
public function getTitleCancellationSourceTransaction($cancellationSource)
738+
{
739+
if (!is_null($cancellationSource)) {
740+
switch ($cancellationSource) {
741+
case "INTERNAL":
742+
return $this->__('PagSeguro');
743+
break;
744+
case "EXTERNAL":
745+
return $this->__('Instituições Financeiras');
746+
break;
747+
default:
748+
return $cancellationSource;
749+
break;
750+
}
751+
}
752+
753+
return false;
754+
}
755+
756+
/**
757+
* Translates the transation type code to his respective name, according with the api
758+
*
759+
* @param int $transactionTypeCode
760+
* @return mixed string | int
761+
*/
762+
public function getTransactionTypeName($transactionTypeCode)
763+
{
764+
if ($transactionTypeCode) {
765+
switch ($transactionTypeCode) {
766+
case 1:
767+
return $this->__('Venda');
768+
break;
769+
case 2:
770+
return $this->__('Transferência');
771+
break;
772+
case 3:
773+
return $this->__('Adição de fundos');
774+
break;
775+
case 4:
776+
return $this->__('Saque');
777+
break;
778+
case 5:
779+
return $this->__('Cobrança');
780+
break;
781+
case 6:
782+
return $this->__('Doação');
783+
break;
784+
case 7:
785+
return $this->__('Bônus');
786+
break;
787+
case 8:
788+
return $this->__('Repasse de bônus');
789+
break;
790+
case 9:
791+
return $this->__('Operacional');
792+
break;
793+
case 10:
794+
return $this->__('Doação pública');
795+
break;
796+
case 11:
797+
return $this->__('Pagamento pré aprovado');
798+
break;
799+
case 12:
800+
return $this->__('Campanha bônus');
801+
break;
802+
case 13:
803+
return $this->__('Secundária');
804+
break;
805+
case 14:
806+
return $this->__('Validador');
807+
break;
808+
default:
809+
return $transactionTypeCode;
810+
break;
811+
}
812+
}
813+
}
605814
}

app/code/community/UOL/PagSeguro/Helper/Log.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,42 @@ public function setUpdateOrderLog($class, $orderId, $transactionCode, $orderStat
9393
$phrase .= "'orderStatus' => '".$orderStatus."'\n ) )";
9494
$this->setLog($phrase, $this->setModule($class));
9595
}
96+
97+
/**
98+
* @param $class
99+
* @param $parametros
100+
*/
101+
public function setSearchListTransactionLog($class, $params)
102+
{
103+
$phrase = "Search(";
104+
105+
$filters = array();
106+
if(isset($params['idMagento'])){
107+
$filters[] = "idMagento = ".$params['idMagento'];
108+
}
109+
110+
if(isset($params['idPagSeguro'])){
111+
$filters[] = "idPagSeguro = '".$params['idPagSeguro']."'";
112+
}
113+
114+
if(isset($params['environment'])){
115+
$filters[] = "environment = '".$params['environment']."'";
116+
}
117+
118+
if(isset($params['startDate']) && isset($params['endDate'])){
119+
$filters[] = "range of dates = '".$params['startDate']." until ".$params['endDate']."'";
120+
}
121+
122+
if(isset($params['status'])){
123+
$filters[] = "status = '".$params['status']."'";
124+
}
125+
126+
if(count($filters) > 0){
127+
$phrase .= implode(' | ', $filters);
128+
}
129+
130+
$phrase .= ")";
131+
$this->setLog($phrase, $this->setModule($class));
132+
}
133+
96134
}

0 commit comments

Comments
 (0)