shetabit/multipay

View on GitHub

Showing 98 of 98 total issues

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

    public function verify(): ReceiptInterface
    {
        $status = (int)Request::input('Status');
        if ($status != 2) {
            $this->purchaseFailed($status);
Severity: Minor
Found in src/Drivers/SEP/SEP.php - About 1 hr to fix

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

        public function verify(): ReceiptInterface
        {
            $authority = $this->invoice->getTransactionId() ?? Request::input('Authority');
            $data = [
                "merchant_id" => $this->settings->merchantId,
    Severity: Minor
    Found in src/Drivers/Minipay/Minipay.php - About 1 hr to fix

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

          public static function rsaEncrypt($message, $public_key, $modulus, $keylength)
          {
              $padded = RSA::addPKCS1Padding($message, true, $keylength / 8);
              $number = RSA::binaryToNumber($padded);
              $encrypted = RSA::powMod($number, $public_key, $modulus);
      Severity: Major
      Found in src/Drivers/Pasargad/Utils/RSA.php and 1 other location - About 1 hr to fix
      src/Drivers/Pasargad/Utils/RSA.php on lines 26..33

      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 105.

      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 rsaSign($message, $private_key, $modulus, $keylength)
          {
              $padded = RSA::addPKCS1Padding($message, false, $keylength / 8);
              $number = RSA::binaryToNumber($padded);
              $signed = RSA::powMod($number, $private_key, $modulus);
      Severity: Major
      Found in src/Drivers/Pasargad/Utils/RSA.php and 1 other location - About 1 hr to fix
      src/Drivers/Pasargad/Utils/RSA.php on lines 9..16

      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 105.

      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 verify has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function verify(): ReceiptInterface
          {
              $tracking_number = Request::post("tracking_number");
              $transid = Request::post("transid");
              if ($tracking_number === null || $tracking_number === ""|| $transid === ""|| $transid === null) {
      Severity: Minor
      Found in src/Drivers/Aqayepardakht/Aqayepardakht.php - About 1 hr to fix

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

            public function verify() : ReceiptInterface
            {
                $refId = Request::input('refid');
                $data = [
                    'amount' => $this->invoice->getAmount() / ($this->settings->currency == 'T' ? 1 : 10), // convert to toman
        Severity: Minor
        Found in src/Drivers/Payping/Payping.php - About 1 hr to fix

          Method verify has 29 lines of code (exceeds 25 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 1 hr to fix

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

                public function verify(): ReceiptInterface
                {
                    $authority = $this->invoice->getTransactionId() ?? Request::input('authority');
                    $data = [
                        'merchant' => $this->settings->merchantId,
            Severity: Minor
            Found in src/Drivers/Sepordeh/Sepordeh.php - About 1 hr to fix

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

                  public function purchase()
                  {
                      $data = array(
                          'action' => 'token',
                          'TerminalId' => $this->settings->terminalId,
              Severity: Minor
              Found in src/Drivers/SEP/SEP.php - About 1 hr to fix

                Method powMod has 28 lines of code (exceeds 25 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 1 hr to fix

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

                      public function purchase()
                      {
                          $data = array(
                              'MID' => $this->settings->merchantId,
                              'ResNum' => $this->invoice->getUuid(),
                  Severity: Minor
                  Found in src/Drivers/Saman/Saman.php - About 1 hr to fix

                    Method _fn_return_state_text has 28 lines of code (exceeds 25 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 1 hr to fix

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

                          public function verify(): ReceiptInterface
                          {
                              $data = array(
                                  'RefNum' => Request::input('RefNum'),
                                  'merchantId' => $this->settings->merchantId,
                      Severity: Minor
                      Found in src/Drivers/Saman/Saman.php - About 1 hr to fix

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

                            public function purchase()
                            {
                                $client = new SoapClient($this->settings->apiPurchaseUrl, array('trace' => true));
                        
                                $data = new stdClass();
                        Severity: Minor
                        Found in src/Drivers/Yekpay/Yekpay.php - About 1 hr to fix

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

                          function fn_atipay_verify_payment($params, $amount)
                          {
                              $r = wsRequestPost(ATIPAY_VERIFY_URL, $params);
                              $return = array();
                              if ($r) {
                          Severity: Minor
                          Found in src/Drivers/Atipay/Core/fn.atipay.php - About 1 hr 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

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

                              public function verify(): ReceiptInterface
                              {
                                  $token = $this->invoice->getTransactionId() ?? Request::input('token');
                                  $refNum = Request::input('RefNum');
                          
                          
                          Severity: Minor
                          Found in src/Drivers/Omidpay/Omidpay.php - About 1 hr to fix

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

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

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

                                  public function verify(): ReceiptInterface
                                  {
                                      $params = $_POST;
                                      $result = fn_check_callback_data($params);
                                      $payment_id = $params['reservationNumber'];
                              Severity: Minor
                              Found in src/Drivers/Atipay/Atipay.php - About 1 hr to fix

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

                                    public function verify() : ReceiptInterface
                                    {
                                        $status = Request::input('responseCode');
                                        if (Request::input('responseCode') != "00") {
                                            return $this->notVerified($status);
                                Severity: Minor
                                Found in src/Drivers/Irankish/Irankish.php - About 1 hr to fix

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

                                      protected function purchaseFailed($status)
                                      {
                                          $translations = [
                                              "1"  => "Internal Server Error",
                                              "2"  => "Resource Not Found",
                                  Severity: Minor
                                  Found in src/Drivers/Azki/Azki.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language