Skip to content

Commit

Permalink
Merge pull request #177 from TransbankDevelopers/fix/kiuwan-bugs1
Browse files Browse the repository at this point in the history
fix: kiuwan bugs1
  • Loading branch information
mvarlic authored Oct 31, 2023
2 parents 3591ac9 + 4648a9f commit 5515fad
Show file tree
Hide file tree
Showing 21 changed files with 56 additions and 567 deletions.
40 changes: 0 additions & 40 deletions plugin/libwebpay/ReportGenerator.php

This file was deleted.

5 changes: 3 additions & 2 deletions plugin/libwebpay/TableCheck.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use Transbank\WooCommerce\WebpayRest\Helpers\LogHandler;
use Transbank\WooCommerce\WebpayRest\Helpers\TbkFactory;
use Transbank\WooCommerce\WebpayRest\Models\Transaction;
use Transbank\WooCommerce\WebpayRest\Models\Inscription;
use Transbank\WooCommerce\WebpayRest\Helpers\DatabaseTableInstaller;
Expand All @@ -9,6 +9,7 @@ class TableCheck
{
public static function check()
{
$logger = TbkFactory::createLogger();
try {
$resp = Transaction::checkExistTable();
if ($resp['ok']){
Expand All @@ -22,7 +23,7 @@ public static function check()
}
}
catch(Exception $e) {
(new LogHandler())->logInfo("Error ejecutando comprobación. Exception "."{$e->getMessage()}");
$logger->logInfo("Error ejecutando comprobación. Exception "."{$e->getMessage()}");
$resp = array('ok' => false, 'error' => "Error ejecutando comprobación.", 'exception' => "{$e->getMessage()}");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Transbank\WooCommerce\WebpayRest\Controllers;

use \Exception;
use Transbank\WooCommerce\WebpayRest\Helpers\LogHandler;
use Transbank\WooCommerce\WebpayRest\Helpers\TbkFactory;
use Transbank\WooCommerce\WebpayRest\OneclickTransbankSdk;
use Transbank\WooCommerce\WebpayRest\Models\Inscription;
use Transbank\WooCommerce\WebpayRest\Exceptions\Oneclick\UserCancelInscriptionOneclickException;
Expand All @@ -27,9 +27,9 @@ class OneclickInscriptionResponseController
/**
* OneclickInscriptionResponseController constructor.
*/
public function __construct($gatewayId, $logger = null)
public function __construct($gatewayId)
{
$this->logger = $logger ?? new LogHandler();
$this->logger = TbkFactory::createLogger();
$this->gatewayId = $gatewayId;
$this->oneclickTransbankSdk = new OneclickTransbankSdk(get_option('environment'), get_option('commerce_code'), get_option('api_key'), get_option('child_commerce_code'));
}
Expand Down
3 changes: 2 additions & 1 deletion plugin/src/Helpers/DatabaseTableInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Transbank\WooCommerce\WebpayRest\Helpers;

use Transbank\WooCommerce\WebpayRest\Helpers\TbkFactory;
use Transbank\WooCommerce\WebpayRest\Models\Inscription;
use Transbank\WooCommerce\WebpayRest\Models\Transaction;
use Transbank\WooCommerce\WebpayRest\Models\TransbankApiServiceLog;
Expand Down Expand Up @@ -162,7 +163,7 @@ public static function createTableProccessError($tableName, $wpdbError): bool
{
$success = empty($wpdbError);
if (!$success) {
$log = new LogHandler();
$log = TbkFactory::createLogger();
$log->logError('Error creating transbank tables: '.$tableName);
$log->logError($wpdbError);

Expand Down
22 changes: 1 addition & 21 deletions plugin/src/Helpers/HealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,6 @@ private function getCommerceInfo()
return ['data' => $result];
}

// guarda en array informacion de funcion phpinfo
private function getPhpInfo()
{
ob_start();
phpinfo();
$info = ob_get_contents();
ob_end_clean();
$newinfo = strstr($info, '<table>');
$newinfo = strstr($newinfo, '<h1>PHP Credits</h1>', true);
$return = ['string' => ['content' => str_replace('</div></body></html>', '', $newinfo)]];

return $return;
}

public function setCreateTransaction()
{
$amount = 990;
Expand Down Expand Up @@ -242,8 +228,7 @@ private function getFullResume()
$this->fullResume = [
'server_resume' => $this->getServerResume(),
'php_extensions_status' => $this->getExtensionsValidate(),
'commerce_info' => $this->getCommerceInfo(),
'php_info' => $this->getPhpInfo(),
'commerce_info' => $this->getCommerceInfo()
];

return $this->fullResume;
Expand All @@ -255,11 +240,6 @@ public function printCommerceInfo()
return json_encode($this->getCommerceInfo());
}

public function printPhpInfo()
{
return json_encode($this->getPhpInfo());
}

// imprime en formato json la validacion de extensiones / modulos de php
public function printExtensionStatus()
{
Expand Down
6 changes: 3 additions & 3 deletions plugin/src/Helpers/InteractsWithFullLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Transbank\WooCommerce\WebpayRest\Helpers;

use Transbank\WooCommerce\WebpayRest\Helpers\LogHandler;
use Transbank\WooCommerce\WebpayRest\Helpers\TbkFactory;

class InteractsWithFullLog {

public function __construct()
{
$this->log = new LogHandler();
$this->log = TbkFactory::createLogger();
}

public function logWebpayPlusInstallConfigLoad($webpayCommerceCode, $webpayDefaultOrderStateIdAfterPayment){
Expand Down Expand Up @@ -238,4 +238,4 @@ public function logOneclickPaymentTodoOk($inscriptionId, $webpayTransaction){
$this->log->logInfo('TRANSACCION VALIDADA POR WooCommerce Y POR TBK EN ESTADO STATUS_APPROVED => INSCRIPTION_ID: '.$inscriptionId);
$this->log->logInfo(json_encode($webpayTransaction));
}
}
}
Loading

0 comments on commit 5515fad

Please sign in to comment.