Skip to content

Commit

Permalink
Atualização do gerencianet para Efipay (#2363)
Browse files Browse the repository at this point in the history
* Atualização do gerencianet para Efipay

* Correção envio de email cobrança

* Requirimentos para Efipay

* Adiconada a Linha após PHP
  • Loading branch information
cabralwms authored Mar 29, 2024
1 parent 41a201a commit a6ae21e
Show file tree
Hide file tree
Showing 4 changed files with 835 additions and 642 deletions.
1 change: 1 addition & 0 deletions application/config/payment_gateways.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
'new' => 'Cobrança / Assinatura gerada',
'waiting' => 'Aguardando a confirmação do pagamento',
'paid' => 'Pagamento confirmado',
'idenfied' => 'Pagamento identificado',
'unpaid' => 'Não foi possível confirmar o pagamento da cobrança',
'refunded' => 'Pagamento devolvido pelo lojista ou pelo intermediador Gerencianet',
'contested' => 'Pagamento em processo de contestação',
Expand Down
12 changes: 6 additions & 6 deletions application/libraries/Gateways/GerencianetSdk.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use Gerencianet\Gerencianet;
use Efi\EfiPay;
use Libraries\Gateways\BasePaymentGateway;
use Libraries\Gateways\Contracts\PaymentGateway;

Expand All @@ -23,7 +23,7 @@ public function __construct()

$gerenciaNetConfig = $this->ci->config->item('payment_gateways')['GerencianetSdk'];
$this->gerenciaNetConfig = $gerenciaNetConfig;
$this->gerenciaNetApi = new Gerencianet([
$this->gerenciaNetApi = new EfiPay([
'client_id' => $gerenciaNetConfig['credentials']['client_id'],
'client_secret' => $gerenciaNetConfig['credentials']['client_secret'],
'sandbox' => $gerenciaNetConfig['production'] !== true,
Expand Down Expand Up @@ -62,13 +62,13 @@ public function enviarPorEmail($id)
'cobrancas/emails/cobranca',
[
'cobranca' => $cobranca,
'emitente' => $emitente[0],
'emitente' => $emitente,
'paymentGatewaysConfig' => $this->ci->config->item('payment_gateways'),
],
true
);

$assunto = "Cobrança - " . $emitente[0]->nome;
$assunto = "Cobrança - " . $emitente->nome;
if ($cobranca->os_id) {
$assunto .= ' - OS #' . $cobranca->os_id;
} else {
Expand All @@ -78,7 +78,7 @@ public function enviarPorEmail($id)
$remetentes = [$cobranca->email];
foreach ($remetentes as $remetente) {
$headers = [
'From' => $emitente[0]->email,
'From' => $emitente->email,
'Subject' => $assunto,
'Return-Path' => ''
];
Expand Down Expand Up @@ -269,7 +269,7 @@ function ($total, $item) {
]
];

$result = $this->gerenciaNetApi->oneStep([], $body);
$result = $this->gerenciaNetApi->createOneStepCharge([], $body);
if (intval($result['code']) !== 200) {
throw new \Exception('Erro ao chamar GerenciaNet!');
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"ext-curl": "*",
"ext-gd": "*",
"mercadopago/dx-php": "^2.2.1",
"gerencianet/gerencianet-sdk-php": "^2.4.1",
"efipay/sdk-php-apis-efi": "^1.8",
"codeigniter/framework": "^3.1",
"mpdf/mpdf": "^8.0.10",
"filp/whoops": "^2.7",
Expand Down
Loading

0 comments on commit a6ae21e

Please sign in to comment.