shetabit/multipay

View on GitHub

Showing 98 of 98 total issues

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

    public function purchase()
    {
        $details = $this->invoice->getDetails();

        $amount = $this->invoice->getAmount() * ($this->settings->currency == 'T' ? 10 : 1); // convert to rial
Severity: Minor
Found in src/Drivers/Zibal/Zibal.php - About 1 hr to fix

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

        public function purchase()
        {
            $data = [
                'pin' => $this->settings->mode === "normal" ? $this->settings->pin : "sandbox",
                'amount' => $this->invoice->getAmount() / ($this->settings->currency == 'T' ? 1 : 10), // convert to toman
    Severity: Minor
    Found in src/Drivers/Aqayepardakht/Aqayepardakht.php - About 1 hr to fix

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

          public function verify(): ReceiptInterface
          {
              $transaction_amount = Request::input('transactionAmount');
              $amount = $this->invoice->getAmount() * ($this->settings->currency == 'T' ? 10 : 1); // convert to rial
      
      
      Severity: Minor
      Found in src/Drivers/Fanavacard/Fanavacard.php - About 1 hr to fix

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

            public function purchase()
            {
                $mobile = $this->extractDetails('mobile');
                $description = $this->extractDetails('description');
                $validCardNumber = $this->extractDetails('validCardNumber');
        Severity: Minor
        Found in src/Drivers/Payir/Payir.php - About 1 hr to fix

          Function _fn_return_state_text has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function _fn_return_state_text($state)
          {
              switch ($state) {
                  case "CanceledByUser":
                      return "پرداخت توسط شما لغو شده است.";
          Severity: Minor
          Found in src/Drivers/Atipay/Core/fn.atipay.php - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public function purchase()
              {
                  $this->invoice->uuid(crc32($this->invoice->getUuid()));
          
                  $result = $this->token();
          Severity: Minor
          Found in src/Drivers/Etebarino/Etebarino.php and 1 other location - About 55 mins to fix
          src/Drivers/Asanpardakht/Asanpardakht.php on lines 71..85

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 98.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              public function purchase()
              {
                  $this->invoice->uuid(crc32($this->invoice->getUuid()));
          
                  $result = $this->token();
          Severity: Minor
          Found in src/Drivers/Asanpardakht/Asanpardakht.php and 1 other location - About 55 mins to fix
          src/Drivers/Etebarino/Etebarino.php on lines 49..63

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 98.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Method paymentRequest has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function paymentRequest($amount, $referenceNumber, $userIdentifier, $callbackUrl, $currency = 'IRR', $description = null, $additionalData = null)
          Severity: Major
          Found in src/Drivers/Jibit/JibitClient.php - About 50 mins to fix

            Function verify has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function verify(): ReceiptInterface
                {
                    $resCode = Request::input('ResCode');
                    if ($resCode != '0') {
                        throw new InvalidPaymentException($this->translateStatus($resCode), $resCode);
            Severity: Minor
            Found in src/Drivers/Behpardakht/Behpardakht.php - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Consider simplifying this complex logical expression.
            Open

                if (!isset($params['state']) ||
                    !isset($params['status']) ||
                    !isset($params['reservationNumber']) ||
                    !isset($params['referenceNumber']) ||
                    !isset($params['terminalId']) ||
            Severity: Major
            Found in src/Drivers/Atipay/Core/fn.atipay.php - About 40 mins to fix

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

                  private function callCurl($url, $arrayData, $haveAuth = false, $try = 0, $method = 'POST')
              Severity: Minor
              Found in src/Drivers/Jibit/JibitClient.php - About 35 mins to fix

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

                    public static function rsaDecrypt($message, $private_key, $modulus, $keylength)
                    {
                        $number = RSA::binaryToNumber($message);
                        $decrypted = RSA::powMod($number, $private_key, $modulus);
                        $result = RSA::numberToBinary($decrypted, $keylength / 8);
                Severity: Minor
                Found in src/Drivers/Pasargad/Utils/RSA.php and 1 other location - About 35 mins to fix
                src/Drivers/Pasargad/Utils/RSA.php on lines 40..46

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 92.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    public static function rsaKypVerify($message, $public_key, $modulus, $keylength)
                    {
                        $number = RSA::binaryToNumber($message);
                        $decrypted = RSA::powMod($number, $public_key, $modulus);
                        $result = RSA::numberToBinary($decrypted, $keylength / 8);
                Severity: Minor
                Found in src/Drivers/Pasargad/Utils/RSA.php and 1 other location - About 35 mins to fix
                src/Drivers/Pasargad/Utils/RSA.php on lines 18..24

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 92.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    public function purchase()
                    {
                        $details = $this->invoice->getDetails();
                
                        $phone = null;
                Severity: Minor
                Found in src/Drivers/Idpay/Idpay.php - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                    private function callCurl($url, $arrayData, $haveAuth = false, $try = 0, $method = 'POST')
                    {
                        $data = $arrayData;
                        $jsonData = json_encode($data);
                        $accessToken = '';
                Severity: Minor
                Found in src/Drivers/Jibit/JibitClient.php - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                    public function purchase()
                    {
                        $data = [
                            'api_key' => $this->settings->merchantId,
                            'order_id' => intval(1, time()) . crc32($this->invoice->getUuid()),
                Severity: Minor
                Found in src/Drivers/Nextpay/Nextpay.php - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                    public static function powMod($p, $q, $r)
                    {
                        $factors = array();
                        $div = $q;
                        $power_of_two = 0;
                Severity: Minor
                Found in src/Drivers/Pasargad/Utils/RSA.php - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Avoid too many return statements within this method.
                Open

                            case -11: return "درگاه در انتظار تایید و یا غیرفعال است.";
                Severity: Major
                Found in src/Drivers/Aqayepardakht/Aqayepardakht.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              case 1: return "پرداخت با موفقیت انجام شد.";
                  Severity: Major
                  Found in src/Drivers/Aqayepardakht/Aqayepardakht.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return "شماره ترمینال ارسال شده یافت نشد";
                    Severity: Major
                    Found in src/Drivers/Atipay/Core/fn.atipay.php - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language