Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correção gerencianet para Efipay #2306

Closed
wants to merge 10 commits into from
1 change: 1 addition & 0 deletions application/config/payment_gateways.php
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linha 6, 7, 8 precisara altera para o seguinte código

    `'EfiPaySdk' => [
    'name' => 'EfiPay by GerenciaNet',
    'library_name' => 'EfiPaySdk',`

Na linha 32 alterar o nome Gerencianet para EfiPay

'refunded' => 'Pagamento devolvido pelo lojista ou pelo intermediador EfiPay',

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',
'identified' => 'Pagamento confirmado',
'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
6 changes: 3 additions & 3 deletions application/libraries/Gateways/GerencianetSdk.php
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nesse Arquivo precisara renomear o arquivo, para EfiPaySdk.php

Na linha 7 renomear a a class para EfiPaySdk

class EfiPaySdk extends BasePaymentGateway

Linhas 9, 10 e 12 alterar para

/** @var EfiPay $efiPayApi */
    private $efiPayApi;
    private $efiPayConfig;

Da linha 24 a 30 alterar

        $efiPayConfig = $this->ci->config->item('payment_gateways')['EfiPaySdk'];
        $this->efiPayConfig = $efiPayConfig;
        $this->efiPayApi = new EfiPay([
            'client_id' => $efiPayConfig['credentials']['client_id'],
            'client_secret' => $efiPayConfig['credentials']['client_secret'],
            'sandbox' => $efiPayConfig['production'] !== true,
            'timeout' => $efiPayConfig['timeout'],

linha 41 alterar para

$response = $this->efiPayApi->cancelCharge(['id' => $cobranca->charge_id], []);

linha 43 para

     `   throw new \Exception('Erro ao chamar EfiPay!');`

Linha 103 e 105 para

  $result = $this->efiPayApi->detailCharge(['id' => $cobranca->charge_id], []);
      
   throw new \Exception('Erro ao chamar EfiPay!');

Linha 138 e 140 para

           $response = $this->efiPayApi->settleCharge(['id' => $cobranca->charge_id], []);
            throw new \Exception('Erro ao chamar EfiPay!');

Linha 250 para

    `$expirationDate = (new DateTime())->add(new DateInterval($this->efiPayConfig['boleto_expiration']));`

Linha 272 e 274 para

        $result = $this->efiPayApi->createOneStepCharge([], $body);
            throw new \Exception('Erro ao chamar EfiPay!');

Linha 288 para

'payment_gateway' => 'EfiPaySdk',

Linha 368 para

$response = $this->efiPayApi->createCharge(

Linha 381 para

       ` throw new \Exception('Erro ao chamar EfiPay!');`

Linha 388 para

$result = $this->efiPayApi->linkCharge(

Linha 400 para

throw new \Exception('Erro ao chamar EfiPay!');

Linha 410 para

'payment_gateway' => 'EfiPaySdk',

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 @@ -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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"ext-curl": "*",
"ext-gd": "*",
"mercadopago/dx-php": "^2.2.1",
"gerencianet/gerencianet-sdk-php": "^2.4.1",
"codeigniter/framework": "^3.1",
"mpdf/mpdf": "^8.0.10",
"filp/whoops": "^2.7",
"mk-j/php_xlsxwriter": "^0.38.0",
"mpdf/qrcode": "^1.1",
"phpoffice/phpword": "^0.18.0",
"piggly/php-pix": "^2.0",
"codephix/asaas-sdk": "dev-master"
"codephix/asaas-sdk": "dev-master",
"efipay/sdk-php-apis-efi": "^1.7.1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vai precisar remover "efipay/sdk-php-apis-efi": "^1.7.1" e depois rodar o comando composer require efipay/sdk-php-apis-efi:^1.7.1 --with-all-dependencies

Pois a maioria tem o SDK do Gerencianet instalado, com o comando ele removi e instala o Efipay.

Do jeito que esta aqui da erro ao rodar o comando composer install --no-dev, devido a dependência do Gerencianet ainda esta no composer.lock

},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
Expand Down
Loading