wikimedia/wikimedia-fundraising-SmashPig

View on GitHub

Showing 476 of 476 total issues

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

    public function testValidateUpiIdValid():void {
        $params = $this->getINCreatePaymentRequestParams();
        $params['upi_id'] = '11111111@axisb';
        $mockResponse = $this->prepareMockResponse( 'validate-upi-id-success.response', 200 );
        $this->curlWrapper->expects( $this->once() )
Severity: Major
Found in PaymentProviders/dlocal/Tests/phpunit/ApiTest.php and 3 other locations - About 1 day to fix
PaymentProviders/dlocal/Tests/phpunit/ApiTest.php on lines 400..423
PaymentProviders/dlocal/Tests/phpunit/ApiTest.php on lines 429..452
PaymentProviders/dlocal/Tests/phpunit/ApiTest.php on lines 458..481

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

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

    public function testCollectUPIDirectFailed(): void {
        $params = $this->getINCreatePaymentRequestParams();
        $params['upi_id'] = 'asdf@axisb';
        $mockResponse = $this->prepareMockResponse( 'collect-bank-direct-failed.response', 200 );
        $this->curlWrapper->expects( $this->once() )
Severity: Major
Found in PaymentProviders/dlocal/Tests/phpunit/ApiTest.php and 3 other locations - About 1 day to fix
PaymentProviders/dlocal/Tests/phpunit/ApiTest.php on lines 372..395
PaymentProviders/dlocal/Tests/phpunit/ApiTest.php on lines 400..423
PaymentProviders/dlocal/Tests/phpunit/ApiTest.php on lines 429..452

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

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

    public function testPaymentWithCompleteParamsSuccess(): void {
        $params = $this->getCreatePaymentRequestParams();
        $gateway_txn_id = "PAY2323243343543";
        $this->api->expects( $this->once() )
            ->method( 'cardAuthorizePayment' )
PaymentProviders/dlocal/Tests/phpunit/CardPaymentProviderTest.php on lines 83..120
PaymentProviders/dlocal/Tests/phpunit/CardPaymentProviderTest.php on lines 122..159

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

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

    public function testPaymentWithCompleteParamsFail(): void {
        $params = $this->getCreatePaymentRequestParams();
        $gateway_txn_id = "PAY2323243343543";
        $this->api->expects( $this->once() )
            ->method( 'cardAuthorizePayment' )
PaymentProviders/dlocal/Tests/phpunit/CardPaymentProviderTest.php on lines 44..81
PaymentProviders/dlocal/Tests/phpunit/CardPaymentProviderTest.php on lines 122..159

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

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

    public function testPaymentWithCompleteParamsPending(): void {
        $params = $this->getCreatePaymentRequestParams();
        $gateway_txn_id = "PAY2323243343543";
        $this->api->expects( $this->once() )
            ->method( 'cardAuthorizePayment' )
PaymentProviders/dlocal/Tests/phpunit/CardPaymentProviderTest.php on lines 44..81
PaymentProviders/dlocal/Tests/phpunit/CardPaymentProviderTest.php on lines 83..120

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

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

    public static function getCurrencyRates() {
        // Not rounding numbers under 1 because I don't think that's a big issue and could cause issues with the max check.
        $currencyRates = [
            'ADF' => 6.04,
            'ADP' => 153,
Severity: Major
Found in PaymentData/ReferenceData/CurrencyRates.php - About 1 day to fix

    File Payment.php has 494 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php namespace SmashPig\PaymentProviders\Adyen\WSDL;
    
    use SmashPig\Core\Logging\Logger;
    use SmashPig\Core\Context;
    
    
    Severity: Minor
    Found in PaymentProviders/Adyen/WSDL/Payment.php - About 7 hrs to fix

      File PaymentProviderTest.php has 473 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace SmashPig\PaymentProviders\dlocal\Tests\phpunit;
      
      use SmashPig\Core\ApiException;
      Severity: Minor
      Found in PaymentProviders/dlocal/Tests/phpunit/PaymentProviderTest.php - About 7 hrs to fix

        File PaymentProvider.php has 462 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace SmashPig\PaymentProviders\Adyen;
        
        use OutOfBoundsException;
        Severity: Minor
        Found in PaymentProviders/Adyen/PaymentProvider.php - About 7 hrs to fix

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

              public function testCreatePaymentTruncateContactDetails() {
                  $params = [
                      'recurring' => true,
                      'installment' => 'recurring',
                      'recurring_payment_token' => '229a1d6e-1b26-4c91-8e00-969a49c9d041',
          PaymentProviders/Ingenico/Tests/phpunit/PaymentProviderTest.php on lines 268..297

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

          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 testCreatePaymentTruncateMultibyte() {
                  $params = [
                      'recurring' => true,
                      'installment' => 'recurring',
                      'recurring_payment_token' => '229a1d6e-1b26-4c91-8e00-969a49c9d041',
          PaymentProviders/Ingenico/Tests/phpunit/PaymentProviderTest.php on lines 237..266

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

          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 testRefundPaymentNotFoundError() {
                  $gateway_txn_id = "dHJhbnNhY3Rpb25fYXIxMTNuZzQ";
                  $request = [
                      "gateway_txn_id" => $gateway_txn_id,
                      "order_id" => '30.1',
          PaymentProviders/Braintree/Tests/phpunit/PaymentProviderTest.php on lines 112..143

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

          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 testRefundPaymentRefundedError() {
                  $gateway_txn_id = "dHJhbnNhY3Rpb25fOHdrNzI0NXk";
                  $request = [
                      "gateway_txn_id" => $gateway_txn_id,
                      "order_id" => '81.1',
          PaymentProviders/Braintree/Tests/phpunit/PaymentProviderTest.php on lines 75..106

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

          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

          File Api.php has 440 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php namespace SmashPig\PaymentProviders\Adyen;
          
          use SmashPig\Core\Context;
          use SmashPig\Core\Helpers\CurrencyRoundingHelper;
          use SmashPig\Core\Helpers\UniqueId;
          Severity: Minor
          Found in PaymentProviders/Adyen/Api.php - About 6 hrs to fix

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

                public function testCancelPaymentReturnsPaymentErrorWithMessagePaymentIdNotFound(): void {
                    $gatewayTxnId = 'D-INVALID-5bc9c596-f3b6-4b7c-bf3c-432276030cd9';
                    $apiError = [
                        "code" => 4000,
                        "message" => "Payment not found"
            PaymentProviders/dlocal/Tests/phpunit/PaymentProviderTest.php on lines 461..485

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

            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 testGetPaymentDetailReturnsPaymentErrorOnAPIException(): void {
                    $gatewayTxnId = 'D-INVALID-5bc9c596-f3b6-4b7c-bf3c-432276030cd9';
                    $apiError = [
                        "code" => 4000,
                        "message" => "Payment not found"
            PaymentProviders/dlocal/Tests/phpunit/PaymentProviderTest.php on lines 197..221

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

            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

            NotificationRequestTest has 43 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class NotificationRequestTest extends BaseAdyenTestCase {
            
                private $jobsAdyenQueue;
            
                private $refundQueue;
            Severity: Minor
            Found in PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php - About 5 hrs to fix

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

                  public function testPreabitrationLostSOAPMessageReceivedAndAcknowledged() {
                      if ( !class_exists( \SoapServer::class ) ) {
                          $this->markTestSkipped( 'Soap server disabled on CI' );
                      }
                      $request = $this->getMockBuilder( Request::class )->disableOriginalConstructor()
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 428..447
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 467..486
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 506..525
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 545..564
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 623..642
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 761..780

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

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

                  public function testOrderClosedSOAPMessageReceivedAndAcknowledged() {
                      if ( !class_exists( \SoapServer::class ) ) {
                          $this->markTestSkipped( 'Soap server disabled on CI' );
                      }
                      $request = $this->getMockBuilder( Request::class )->disableOriginalConstructor()
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 428..447
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 467..486
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 545..564
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 584..603
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 623..642
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 761..780

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

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

                  public function testNotificationOfChargebackSOAPMessageReceivedAndAcknowledged() {
                      if ( !class_exists( \SoapServer::class ) ) {
                          $this->markTestSkipped( 'Soap server disabled on CI' );
                      }
                      $request = $this->getMockBuilder( Request::class )->disableOriginalConstructor()
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 467..486
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 506..525
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 545..564
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 584..603
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 623..642
              PaymentProviders/Adyen/Tests/phpunit/NotificationRequestTest.php on lines 761..780

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

              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

              Severity
              Category
              Status
              Source
              Language