elisei/pagbank-payment-magento

View on GitHub

Showing 148 of 148 total issues

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

    public function getConfig()
    {
        $storeId = $this->cart->getStoreId();

        return [
Severity: Major
Found in Model/Ui/ConfigProviderDeepLink.php and 1 other location - About 4 hrs to fix
Model/Ui/ConfigProviderPix.php on lines 82..99

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

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

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

    public function getConfig()
    {
        $storeId = $this->cart->getStoreId();

        return [
Severity: Major
Found in Model/Ui/ConfigProviderPix.php and 1 other location - About 4 hrs to fix
Model/Ui/ConfigProviderDeepLink.php on lines 82..99

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

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

Config has 19 functions (exceeds 10 allowed). Consider refactoring.
Open

class Config extends PaymentConfig
{
    /**
     * @const string
     */
Severity: Minor
Found in Gateway/Config/Config.php - About 3 hrs to fix

    ConfigCc has 16 functions (exceeds 10 allowed). Consider refactoring.
    Open

    class ConfigCc extends PaymentConfig
    {
        /**
         * @const string
         */
    Severity: Minor
    Found in Gateway/Config/ConfigCc.php - About 3 hrs to fix

      Function handle has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public function handle(array $handlingSubject, array $response)
          {
              if (!isset($handlingSubject['payment'])
                  || !$handlingSubject['payment'] instanceof PaymentDataObjectInterface
              ) {
      Severity: Minor
      Found in Gateway/Response/FetchPaymentHandler.php - About 2 hrs 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

      Oauth has 12 functions (exceeds 10 allowed). Consider refactoring.
      Open

      class Oauth extends Field
      {
          /**
           * Template oAuth.
           */
      Severity: Minor
      Found in Block/Adminhtml/System/Config/Oauth.php - About 2 hrs to fix

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

            public function getTaxId($payment, $orderAdapter): ?string
            {
                $taxId = null;
        
                if ($payment->getAdditionalInformation('payer_tax_id')) {
        Severity: Major
        Found in Gateway/Request/CustomerDataRequest.php and 1 other location - About 2 hrs to fix
        Gateway/Request/Boleto/HolderDataRequest.php on lines 131..144

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

        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

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

            public function getTaxId($payment, $orderAdapter): ?string
            {
                $taxId = null;
        
                if ($payment->getAdditionalInformation('payer_tax_id')) {
        Severity: Major
        Found in Gateway/Request/Boleto/HolderDataRequest.php and 1 other location - About 2 hrs to fix
        Gateway/Request/CustomerDataRequest.php on lines 190..203

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

        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 __construct has 13 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                Config $config,
                Context $context,
                Json $json,
                SearchCriteriaBuilder $searchCriteria,
                TransactionRepositoryInterface $transaction,
        Severity: Major
        Found in Controller/AbstractNotification.php - About 1 hr to fix

          Method getPurchaseItems has 55 lines of code (exceeds 40 allowed). Consider refactoring.
          Open

              public function getPurchaseItems(
                  $order
              ) {
                  $result = [];
                  $items = $order->getItems();
          Severity: Major
          Found in Gateway/Request/ItemsDataRequest.php - About 1 hr to fix

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

            define([
                'jquery',
                'Magento_Checkout/js/view/payment/default',
                'PagBank_PaymentMagento/js/view/payment/payer-form',
                'PagBank_PaymentMagento/js/view/payment/base-data-for-payment-form'
            view/frontend/web/js/view/payment/method-renderer/boleto.js on lines 10..110
            view/frontend/web/js/view/payment/method-renderer/pix.js on lines 10..110

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

            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 3 locations. Consider refactoring.
            Open

            define([
                'jquery',
                'Magento_Checkout/js/view/payment/default',
                'PagBank_PaymentMagento/js/view/payment/payer-form',
                'PagBank_PaymentMagento/js/view/payment/base-data-for-payment-form'
            Severity: Major
            Found in view/frontend/web/js/view/payment/method-renderer/pix.js and 2 other locations - About 1 hr to fix
            view/frontend/web/js/view/payment/method-renderer/boleto.js on lines 10..110
            view/frontend/web/js/view/payment/method-renderer/deep-link.js on lines 10..110

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

            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 3 locations. Consider refactoring.
            Open

            define([
                'jquery',
                'Magento_Checkout/js/view/payment/default',
                'PagBank_PaymentMagento/js/view/payment/payer-form',
                'PagBank_PaymentMagento/js/view/payment/base-data-for-payment-form'
            view/frontend/web/js/view/payment/method-renderer/deep-link.js on lines 10..110
            view/frontend/web/js/view/payment/method-renderer/pix.js on lines 10..110

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

            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

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

                public function getValueForTaxId($orderAdapter)
                {
                    $obtainTaxDocFrom = $this->config->getAddtionalValue('get_tax_id_from');
            
                    $taxId = $orderAdapter->getCustomerTaxvat();
            Severity: Major
            Found in Gateway/Request/CustomerDataRequest.php and 1 other location - About 1 hr to fix
            Gateway/Request/Boleto/HolderDataRequest.php on lines 153..164

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

            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

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

                public function getValueForTaxId($orderAdapter)
                {
                    $obtainTaxDocFrom = $this->config->getAddtionalValue('get_tax_id_from');
            
                    $taxId = $orderAdapter->getCustomerTaxvat();
            Severity: Major
            Found in Gateway/Request/Boleto/HolderDataRequest.php and 1 other location - About 1 hr to fix
            Gateway/Request/CustomerDataRequest.php on lines 212..223

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

            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 initialize has 47 lines of code (exceeds 40 allowed). Consider refactoring.
            Open

                    initialize() {
                        var self = this,
                            number;
            
                        self._super();
            Severity: Minor
            Found in view/frontend/web/js/view/payment/cc-form.js - About 1 hr to fix

              Function findForPaymentStatus has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function findForPaymentStatus($response, $charges)
                  {
                      $isPix = isset($response[self::RESPONSE_QR_CODES]);
                      $isTempCancel = false;
              
              
              Severity: Minor
              Found in Gateway/Response/FetchPaymentHandler.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

              Function getPreOrderData has 45 lines of code (exceeds 40 allowed). Consider refactoring.
              Open

                      getPreOrderData(
                          cardPayData
                      ) {
                          var totalAmount = parseFloat(quote.totals()['base_grand_total']) * 100,
                              customerEmail = quote.guestEmail ? quote.guestEmail : window.checkoutConfig.customerData.email,
              Severity: Minor
              Found in view/base/web/js/model/pagbank-pre-order-data.js - About 1 hr to fix

                Method getPagBankInstallments has 44 lines of code (exceeds 40 allowed). Consider refactoring.
                Open

                    public function getPagBankInstallments($storeId, $creditCardBin, $amount)
                    {
                        /** @var LaminasClient $client */
                        $client = $this->httpClientFactory->create();
                        $url = $this->configBase->getApiUrl($storeId);
                Severity: Minor
                Found in Model/Api/ConsultPSInstallments.php - About 1 hr to fix

                  Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          TypeListInterface $cacheTypeList,
                          Pool $cacheFrontendPool,
                          Logger $logger,
                          State $state,
                          ScopeConfigInterface $scopeConfig,
                  Severity: Major
                  Found in Model/Console/Command/Basic/Refresh.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language