-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from TransbankDevelopers/fix/kiuwan-bugs-2
fix: kiuwan bugs 2
- Loading branch information
Showing
73 changed files
with
552 additions
and
897 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,43 @@ | ||
<?php | ||
|
||
use Transbank\WooCommerce\WebpayRest\Helpers\HealthCheckFactory; | ||
use Transbank\WooCommerce\WebpayRest\WebpayplusTransbankSdk; | ||
|
||
class ConnectionCheck | ||
{ | ||
public static function check() | ||
{ | ||
$healthCheck = HealthCheckFactory::create(); | ||
|
||
$resp = $healthCheck->setCreateTransaction(); | ||
$resp = ConnectionCheck::setCreateTransaction(); | ||
|
||
header('Content-Type: application/json'); | ||
ob_clean(); | ||
echo json_encode($resp); | ||
wp_die(); | ||
} | ||
|
||
public static function setCreateTransaction() | ||
{ | ||
$amount = 990; | ||
$buyOrder = '_Healthcheck_'; | ||
$sessionId = uniqid(); | ||
$returnUrl = 'http://test.com/test'; | ||
|
||
$status = 'Error'; | ||
try { | ||
$webpayplusTransbankSdk = new WebpayplusTransbankSdk(); | ||
$result = $webpayplusTransbankSdk->createInner(0, $buyOrder, $sessionId, $amount, $returnUrl); | ||
$status = 'OK'; | ||
|
||
} catch (\Exception $e) { | ||
$status = 'Error'; | ||
$result = [ | ||
'error' => 'Error al crear la transacción', | ||
'detail' => $e->getMessage() | ||
]; | ||
} | ||
|
||
return [ | ||
'status' => ['string' => $status], | ||
'response' => $result | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions; | ||
|
||
use Transbank\Plugin\Helpers\ExceptionConstants; | ||
|
||
class BaseException extends \Exception | ||
{ | ||
public function __construct($message, \Exception $previous = null) { | ||
parent::__construct($message, ExceptionConstants::DEFAULT_CODE, $previous); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions; | ||
|
||
class InvalidOrderException extends BaseException | ||
{ | ||
} |
10 changes: 10 additions & 0 deletions
10
plugin/shared/Exceptions/Oneclick/AuthorizeOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions\Oneclick; | ||
|
||
use Transbank\Plugin\Exceptions\BaseException; | ||
|
||
class AuthorizeOneclickException extends BaseException | ||
{ | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
plugin/shared/Exceptions/Oneclick/ConstraintsViolatedAuthorizeOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions\Oneclick; | ||
|
||
use Transbank\Plugin\Exceptions\BaseException; | ||
|
||
class ConstraintsViolatedAuthorizeOneclickException extends BaseException | ||
{ | ||
private $authorizeResponse; | ||
|
||
public function __construct($message, $authorizeResponse, \Exception $previous = null) { | ||
$this->authorizeResponse = $authorizeResponse; | ||
parent::__construct($message, $previous); | ||
} | ||
|
||
public function getAuthorizeResponse() { | ||
return $this->authorizeResponse; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
plugin/shared/Exceptions/Oneclick/CreateTransactionOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions\Oneclick; | ||
|
||
use Transbank\Plugin\Exceptions\BaseException; | ||
|
||
class CreateTransactionOneclickException extends BaseException | ||
{ | ||
|
||
} |
10 changes: 6 additions & 4 deletions
10
...ck/FinishInscriptionOneclickException.php → ...ck/FinishInscriptionOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
plugin/shared/Exceptions/Oneclick/GetInscriptionOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions\Oneclick; | ||
|
||
use Transbank\Plugin\Exceptions\BaseException; | ||
|
||
class GetInscriptionOneclickException extends BaseException | ||
{ | ||
} |
20 changes: 20 additions & 0 deletions
20
plugin/shared/Exceptions/Oneclick/GetTransactionOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions\Oneclick; | ||
|
||
use Transbank\Plugin\Exceptions\BaseException; | ||
|
||
class GetTransactionOneclickException extends BaseException | ||
{ | ||
private $orderId; | ||
|
||
public function __construct($message, $orderId, \Exception $previous = null) { | ||
$this->orderId = $orderId; | ||
parent::__construct($message, $previous); | ||
} | ||
|
||
public function getOrderId() { | ||
return $this->orderId; | ||
} | ||
|
||
} |
10 changes: 6 additions & 4 deletions
10
...serCancelInscriptionOneclickException.php → ...lidStatusInscriptionOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
plugin/shared/Exceptions/Oneclick/NotFoundTransactionOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions\Oneclick; | ||
|
||
use Transbank\Plugin\Exceptions\BaseException; | ||
|
||
class NotFoundTransactionOneclickException extends BaseException | ||
{ | ||
private $orderId; | ||
|
||
public function __construct($message, $orderId, \Exception $previous = null) { | ||
$this->orderId = $orderId; | ||
parent::__construct($message, $previous); | ||
} | ||
|
||
public function getOrderId() { | ||
return $this->orderId; | ||
} | ||
|
||
} |
11 changes: 7 additions & 4 deletions
11
...ions/Oneclick/RefundOneclickException.php → ...ions/Oneclick/RefundOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
plugin/shared/Exceptions/Oneclick/RejectedAuthorizeOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions\Oneclick; | ||
|
||
use Transbank\Plugin\Exceptions\BaseException; | ||
|
||
class RejectedAuthorizeOneclickException extends BaseException | ||
{ | ||
private $authorizeResponse; | ||
|
||
public function __construct($message, $authorizeResponse, \Exception $previous = null) { | ||
$this->authorizeResponse = $authorizeResponse; | ||
parent::__construct($message, $previous); | ||
} | ||
|
||
public function getAuthorizeResponse() { | ||
return $this->authorizeResponse; | ||
} | ||
} |
11 changes: 7 additions & 4 deletions
11
.../RejectedInscriptionOneclickException.php → .../RejectedInscriptionOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 7 additions & 4 deletions
11
...click/RejectedRefundOneclickException.php → ...click/RejectedRefundOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
plugin/shared/Exceptions/Oneclick/StartInscriptionOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions\Oneclick; | ||
|
||
use Transbank\Plugin\Exceptions\BaseException; | ||
|
||
class StartInscriptionOneclickException extends BaseException | ||
{ | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
plugin/shared/Exceptions/Oneclick/StartOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions\Oneclick; | ||
|
||
use Transbank\Plugin\Exceptions\BaseException; | ||
|
||
class StartOneclickException extends BaseException | ||
{ | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
plugin/shared/Exceptions/Oneclick/StatusOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Transbank\Plugin\Exceptions\Oneclick; | ||
|
||
use Transbank\Plugin\Exceptions\BaseException; | ||
|
||
class StatusOneclickException extends BaseException | ||
{ | ||
private $buyOrder; | ||
|
||
public function __construct($message, $buyOrder, \Exception $previous = null) { | ||
$this->buyOrder = $buyOrder; | ||
parent::__construct($message, $previous); | ||
} | ||
|
||
public function getBuyOrder() { | ||
return $this->buyOrder; | ||
} | ||
|
||
} |
10 changes: 6 additions & 4 deletions
10
...k/TimeoutInscriptionOneclickException.php → ...k/TimeoutInscriptionOneclickException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.