Skip to content

Commit

Permalink
Merge pull request #213 from ffflabs/hotfix/typos-in-v2.0.3
Browse files Browse the repository at this point in the history
Mostly typos and phpdocs fixes
  • Loading branch information
mvarlic authored Jul 1, 2021
2 parents cd5aa51 + 29883e5 commit 2997578
Show file tree
Hide file tree
Showing 18 changed files with 156 additions and 131 deletions.
76 changes: 39 additions & 37 deletions src/Onepay/BaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,42 @@

namespace Transbank\Onepay;

/**
* @class BaseRequest
* Basic request class that includes commonly used members
*/
class BaseRequest
{
public function __construct()
{
$this->apiKey = null;
$this->appKey = null;
$this->generateOttQrCode = true;
}

public function getApiKey()
{
return $this->apiKey;
}

public function setApiKey($apiKey)
{
$this->apiKey = $apiKey;

return $this;
}

public function getAppKey()
{
return $this->appKey;
}

public function setAppKey($appKey)
{
$this->appKey = $appKey;

return $this;
}
}
/**
* @class BaseRequest
* Basic request class that includes commonly used members
*/
class BaseRequest
{
private $apiKey;
private $appKey;

public function __construct()
{
$this->apiKey = null;
$this->appKey = null;
}

public function getApiKey()
{
return $this->apiKey;
}

public function setApiKey($apiKey)
{
$this->apiKey = $apiKey;

return $this;
}

public function getAppKey()
{
return $this->appKey;
}

public function setAppKey($appKey)
{
$this->appKey = $appKey;

return $this;
}
}
75 changes: 39 additions & 36 deletions src/Onepay/BaseResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,42 @@

namespace Transbank\Onepay;

/**
* @class BaseResponse
* Basic response class that includes commonly used members
*/
class BaseResponse
{
public function __construct()
{
$this->responseCode = null;
$this->description = null;
}

public function getResponseCode()
{
return $this->responseCode;
}

public function setResponseCode($responseCode)
{
$this->responseCode = $responseCode;

return $this;
}

public function getDescription()
{
return $this->description;
}

public function setDescription($appKey)
{
$this->description = $appKey;

return $this;
}
}
/**
* @class BaseResponse
* Basic response class that includes commonly used members
*/
class BaseResponse
{
private $responseCode;
private $description;

public function __construct()
{
$this->responseCode = null;
$this->description = null;
}

public function getResponseCode()
{
return $this->responseCode;
}

public function setResponseCode($responseCode)
{
$this->responseCode = $responseCode;

return $this;
}

public function getDescription()
{
return $this->description;
}

public function setDescription($appKey)
{
$this->description = $appKey;

return $this;
}
}
4 changes: 2 additions & 2 deletions src/Onepay/Exceptions/SignException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class SignException extends TransbankException
{
const DEFAULT_MESSAGE = 'Signature does not match';

public function __construc($message = self::DEFAULT_MESSAGE, $code = 0, $previous = null)
public function __construct($message = self::DEFAULT_MESSAGE, $code = 0, $previous = null)
{
parent::_construct($message, $code, $previous);
parent::__construct($message, $code, $previous);
}
}
4 changes: 2 additions & 2 deletions src/Onepay/Exceptions/TransactionCommitException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class TransactionCommitException extends TransbankException
{
const DEFAULT_MESSAGE = 'Error when commiting Transaction. Please verify the given parameters.';

public function __construc($message = self::DEFAULT_MESSAGE, $code = 0, $previous = null)
public function __construct($message = self::DEFAULT_MESSAGE, $code = 0, $previous = null)
{
parent::_construct($message, $code, $previous);
parent::__construct($message, $code, $previous);
}
}
24 changes: 12 additions & 12 deletions src/Onepay/Exceptions/TransactionCreateException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace Transbank\Onepay\Exceptions;

/**
* class TransactionCreateException
* Raised when giving invalid params to a TransactionCreateRequest.
*/
class TransactionCreateException extends TransbankException
{
const DEFAULT_MESSAGE = 'Transaction could not be created. Please verify given parameters';
/**
* class TransactionCreateException
* Raised when giving invalid params to a TransactionCreateRequest.
*/
class TransactionCreateException extends TransbankException
{
const DEFAULT_MESSAGE = 'Transaction could not be created. Please verify given parameters';

public function __construc($message = self::DEFAULT_MESSAGE, $code = 0, $previous = null)
{
parent::_construct($message, $code, $previous);
}
}
public function __construct($message = self::DEFAULT_MESSAGE, $code = 0, $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
4 changes: 2 additions & 2 deletions src/Onepay/Exceptions/TransbankException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class TransbankException extends \Exception
{
const DEFAULT_MESSAGE = 'An error has happened, verify given parameters and try again.';

public function __construc($message = self::DEFAULT_MESSAGE, $code = 0, $previous = null)
public function __construct($message = self::DEFAULT_MESSAGE, $code = 0, $previous = null)
{
parent::_construct($message, $code, $previous);
parent::__construct($message, $code, $previous);
}
}
18 changes: 11 additions & 7 deletions src/Onepay/OnepayBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ class OnepayBase
{
const DEFAULT_CALLBACK = 'http://no.callback.has/been.set';

public static $appKeys = ['TEST' => '1a0c0639-bd2f-4846-8d26-81f43187e797',
public static $appKeys = [
'TEST' => '1a0c0639-bd2f-4846-8d26-81f43187e797',
'LIVE' => '2B571C49-C1B6-4AD1-9806-592AC68023B7',
'MOCK' => '04533c31-fe7e-43ed-bbc4-1c8ab1538afp', ];
'MOCK' => '04533c31-fe7e-43ed-bbc4-1c8ab1538afp',
];
public static $callbackUrl = null;

public static $serverBasePath;
Expand Down Expand Up @@ -66,14 +68,16 @@ public static function setCommerceLogoUrl($commerceLogoUrl)

public static function integrationTypes($type = null)
{
$types = ['TEST' => 'https://onepay.ionix.cl',
$types = [
'TEST' => 'https://onepay.ionix.cl',
'LIVE' => 'https://www.onepay.cl',
'MOCK' => 'https://transbank-onepay-ewallet-mock.herokuapp.com', ];
'MOCK' => 'https://transbank-onepay-ewallet-mock.herokuapp.com',
];

if (!$type) {
return $types;
} elseif (!$types[$type]) {
throw new \Exception('Invalid type, valid types: '.join(array_keys($types), ', '));
throw new \Exception('Invalid type, valid types: '.join(', ', array_keys($types)));
} else {
return $types[$type];
}
Expand Down Expand Up @@ -168,7 +172,7 @@ public static function getIntegrationTypeUrl($type)
$url = self::integrationTypes()[$type];
if (!$url) {
$integrationTypes = array_keys(self::integrationTypes());
$integrationTypesAsString = join($integrationTypes, ', ');
$integrationTypesAsString = join(', ', $integrationTypes);

throw new \Exception('Invalid integration type, valid values are: '.$integrationTypesAsString);
}
Expand All @@ -191,7 +195,7 @@ public static function setCurrentIntegrationType($type)
{
if (!self::integrationTypes()[$type]) {
$integrationTypes = array_keys(self::integrationTypes());
$integrationTypesAsString = join($integrationTypes, ', ');
$integrationTypesAsString = join(', ', $integrationTypes);

throw new \Exception('Invalid integration type, valid values are: '.$integrationTypesAsString);
}
Expand Down
4 changes: 4 additions & 0 deletions src/Onepay/TransactionCreateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class TransactionCreateRequest extends BaseRequest implements \JsonSerializable
private $signature; // String
private $generateOttQrCode = true;
private $commerceLogoUrl;
private $issuedAt;
private $widthHeight;

public function __construct(
$externalUniqueNumber,
Expand All @@ -31,6 +33,8 @@ public function __construct(
$widthHeight = '',
$commerceLogoUrl = ''
) {
$this->generateOttQrCode = true;

if (!$externalUniqueNumber) {
throw new \Exception('External unique number cannot be null.');
}
Expand Down
5 changes: 5 additions & 0 deletions src/Patpass/PatpassByWebpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ public static function configureForTesting()
{
self::configureForIntegration(static::DEFAULT_COMMERCE_CODE, static::DEFAULT_API_KEY);
}

public static function getDefaultOptions()
{
return Options::forIntegration(static::DEFAULT_COMMERCE_CODE, static::DEFAULT_API_KEY);
}
}
17 changes: 17 additions & 0 deletions src/Patpass/PatpassByWebpay/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Transbank\Patpass\PatpassByWebpay;

use Transbank\Patpass\Options;
use Transbank\Patpass\PatpassByWebpay;
use Transbank\Patpass\PatpassByWebpay\Exceptions\TransactionCommitException;
use Transbank\Patpass\PatpassByWebpay\Exceptions\TransactionCreateException;
use Transbank\Patpass\PatpassByWebpay\Exceptions\TransactionStatusException;
Expand Down Expand Up @@ -68,4 +70,19 @@ public function status($token)

return new TransactionStatusResponse($response);
}

/**
* Get the default options if none are given.
*
* @return Options|null
*/
public static function getGlobalOptions()
{
return PatpassByWebpay::getOptions();
}

public static function getDefaultOptions()
{
return PatpassByWebpay::getDefaultOptions();
}
}
8 changes: 0 additions & 8 deletions src/Utils/ConfiguresEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
*/
trait ConfiguresEnvironment
{
/**
* @return string
*/
public static function getIntegrationType()
{
return static::$integrationType;
}

/**
* @param $commerceCode
* @param string $apiKey
Expand Down
Loading

0 comments on commit 2997578

Please sign in to comment.