paypay/paypayopa-sdk-php

View on GitHub

Showing 15 of 15 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function revertAuth($payload)
{
$this->payloadTypeCheck($payload, new RevertAuthPayload());
$main = $this->MainInst;
$data = $payload->serialize();
Severity: Major
Found in src/Controllers/Payment.php and 1 other location - About 3 hrs to fix
src/Controllers/Payment.php on lines 178..189

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function capturePaymentAuth($payload)
{
$this->payloadTypeCheck($payload, new CapturePaymentAuthPayload());
$main = $this->MainInst;
$data = $payload->serialize();
Severity: Major
Found in src/Controllers/Payment.php and 1 other location - About 3 hrs to fix
src/Controllers/Payment.php on lines 202..213

Function validate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

public function validate($throwErrors = true)
{
$faults = [];
$iterable = get_object_vars($this);
foreach ($this->descriptor as $memberName => $memberInfo) {
Severity: Minor
Found in src/core/Model.php - About 2 hrs to fix

Method doCall has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

protected function doCall($lookupApi, $apiId, $url, $data, $options)
{
if ($lookupApi) {
$apiInfo = $this->main()->GetApiMapping($apiId);
$callType = strtolower($apiInfo["method"]);
Severity: Minor
Found in src/core/Controller.php - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    public function getRefundDetails($merchantRefundId)
    {
    $main = $this->MainInst;
    $url = $main->GetConfig('API_URL') . $main->GetEndpoint('REFUND') . "/$merchantRefundId";
    $endpoint = '/v2' . $main->GetEndpoint('REFUND') . "/$merchantRefundId";
    Severity: Major
    Found in src/Controllers/Refund.php and 1 other location - About 1 hr to fix
    src/Controllers/CashBack.php on lines 61..68

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    public function getCashbackDetails($merchatCashbackId, $paymentType = 'CASHBACK')
    {
    $main = $this->MainInst;
    $url = $main->GetConfig('API_URL') . $main->GetEndpoint('CASHBACK') . "/$merchatCashbackId";
    $endpoint = '/v2' . $main->GetEndpoint('CASHBACK') . "/$merchatCashbackId";
    Severity: Major
    Found in src/Controllers/CashBack.php and 1 other location - About 1 hr to fix
    src/Controllers/Refund.php on lines 51..59

    Function doCall has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    protected function doCall($lookupApi, $apiId, $url, $data, $options)
    {
    if ($lookupApi) {
    $apiInfo = $this->main()->GetApiMapping($apiId);
    $callType = strtolower($apiInfo["method"]);
    Severity: Minor
    Found in src/core/Controller.php - About 1 hr to fix

    Method __construct has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    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);
    }
    Severity: Minor
    Found in src/Client.php - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      public function getUserAuthorizationStatus($userAuthorizationId)
      {
      if (!$userAuthorizationId) {
      $userAuthorizationId = $this->userAuthorizationId;
      }
      Severity: Minor
      Found in src/Controllers/User.php and 1 other location - About 1 hr to fix
      src/Controllers/User.php on lines 111..121

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      public function getMaskedUserProfile($userAuthorizationId)
      {
      if (!$userAuthorizationId) {
      $userAuthorizationId = $this->userAuthorizationId;
      }
      Severity: Minor
      Found in src/Controllers/User.php and 1 other location - About 1 hr to fix
      src/Controllers/User.php on lines 91..101

      Method PayPayEncryptHeader has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function PayPayEncryptHeader($apiKey, $apiSecret, $method, $resource, $contentType, $payload)
      Severity: Minor
      Found in src/helpers/utility_hmac.php - About 45 mins to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        public function cancelPayment($merchantPaymentId, $paymentType = 'web_cashier')
        {
        $endpoint = $this->endpointByPaymentType($paymentType, $merchantPaymentId)['endpoint'];
        $url = $this->endpointByPaymentType($paymentType, $merchantPaymentId)['url'];
        $options = $this->HmacCallOpts('DELETE', $endpoint);
        Severity: Minor
        Found in src/Controllers/Payment.php and 1 other location - About 45 mins to fix
        src/Controllers/Payment.php on lines 114..120

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        public function getPaymentDetails($merchantPaymentId, $paymentType = 'web_cashier')
        {
        $endpoint = $this->endpointByPaymentType($paymentType, $merchantPaymentId)['endpoint'];
        $url = $this->endpointByPaymentType($paymentType, $merchantPaymentId)['url'];
        $options = $this->HmacCallOpts('GET', $endpoint);
        Severity: Minor
        Found in src/Controllers/Payment.php and 1 other location - About 45 mins to fix
        src/Controllers/Payment.php on lines 134..140

        Method doCall has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        protected function doCall($lookupApi, $apiId, $url, $data, $options)
        Severity: Minor
        Found in src/core/Controller.php - About 35 mins to fix

          Function __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          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);
          }
          Severity: Minor
          Found in src/Client.php - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language