Similar blocks of code found in 2 locations. Consider refactoring.
public function revertAuth($payload)
{
$this->payloadTypeCheck($payload, new RevertAuthPayload());
$main = $this->MainInst;
$data = $payload->serialize();
Similar blocks of code found in 2 locations. Consider refactoring.
public function capturePaymentAuth($payload)
{
$this->payloadTypeCheck($payload, new CapturePaymentAuthPayload());
$main = $this->MainInst;
$data = $payload->serialize();
Function validate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
public function validate($throwErrors = true)
{
$faults = [];
$iterable = get_object_vars($this);
foreach ($this->descriptor as $memberName => $memberInfo) {
Method doCall
has 42 lines of code (exceeds 25 allowed). Consider refactoring.
protected function doCall($lookupApi, $apiId, $url, $data, $options)
{
if ($lookupApi) {
$apiInfo = $this->main()->GetApiMapping($apiId);
$callType = strtolower($apiInfo["method"]);
Similar blocks of code found in 2 locations. Consider refactoring.
public function getRefundDetails($merchantRefundId)
{
$main = $this->MainInst;
$url = $main->GetConfig('API_URL') . $main->GetEndpoint('REFUND') . "/$merchantRefundId";
$endpoint = '/v2' . $main->GetEndpoint('REFUND') . "/$merchantRefundId";
Similar blocks of code found in 2 locations. Consider refactoring.
public function getCashbackDetails($merchatCashbackId, $paymentType = 'CASHBACK')
{
$main = $this->MainInst;
$url = $main->GetConfig('API_URL') . $main->GetEndpoint('CASHBACK') . "/$merchatCashbackId";
$endpoint = '/v2' . $main->GetEndpoint('CASHBACK') . "/$merchatCashbackId";
Function doCall
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
protected function doCall($lookupApi, $apiId, $url, $data, $options)
{
if ($lookupApi) {
$apiInfo = $this->main()->GetApiMapping($apiId);
$callType = strtolower($apiInfo["method"]);
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
public function __construct($auth = null, $productionmode = false, $requestHandler = false)
{
if (!isset($auth['API_KEY']) || !isset($auth['API_SECRET'])) {
throw new ClientException("Invalid auth credentials", 1);
}
Similar blocks of code found in 2 locations. Consider refactoring.
public function getUserAuthorizationStatus($userAuthorizationId)
{
if (!$userAuthorizationId) {
$userAuthorizationId = $this->userAuthorizationId;
}
Similar blocks of code found in 2 locations. Consider refactoring.
public function getMaskedUserProfile($userAuthorizationId)
{
if (!$userAuthorizationId) {
$userAuthorizationId = $this->userAuthorizationId;
}
Method PayPayEncryptHeader
has 6 arguments (exceeds 4 allowed). Consider refactoring.
function PayPayEncryptHeader($apiKey, $apiSecret, $method, $resource, $contentType, $payload)
Similar blocks of code found in 2 locations. Consider refactoring.
public function cancelPayment($merchantPaymentId, $paymentType = 'web_cashier')
{
$endpoint = $this->endpointByPaymentType($paymentType, $merchantPaymentId)['endpoint'];
$url = $this->endpointByPaymentType($paymentType, $merchantPaymentId)['url'];
$options = $this->HmacCallOpts('DELETE', $endpoint);
Similar blocks of code found in 2 locations. Consider refactoring.
public function getPaymentDetails($merchantPaymentId, $paymentType = 'web_cashier')
{
$endpoint = $this->endpointByPaymentType($paymentType, $merchantPaymentId)['endpoint'];
$url = $this->endpointByPaymentType($paymentType, $merchantPaymentId)['url'];
$options = $this->HmacCallOpts('GET', $endpoint);
Method doCall
has 5 arguments (exceeds 4 allowed). Consider refactoring.
protected function doCall($lookupApi, $apiId, $url, $data, $options)
Function __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
public function __construct($auth = null, $productionmode = false, $requestHandler = false)
{
if (!isset($auth['API_KEY']) || !isset($auth['API_SECRET'])) {
throw new ClientException("Invalid auth credentials", 1);
}