mercadopago/cart-virtuemart

View on GitHub

Showing 31 of 38 total issues

Method updateStatusOrder has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function updateStatusOrder($payment_method, $order_id, $status, $payment){
        $status_http = "HTTP/1.1 200 OK";

        $orderModel=VmModel::getModel('orders');
        $order = $orderModel->getOrder($order_id);
Severity: Minor
Found in mercadopago/mercadopago.php - About 1 hr to fix

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

        function getItemsFromCart($cart, $payment_method){
            $total_sum = 0;
            $total_order = (float) ($cart->cartPrices['billTotal'] - $cart->cartPrices['salesPriceShipment']);
            $items = array();
    
    
    Severity: Minor
    Found in mercadopago/mercadopago.php - About 1 hr to fix

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

          function plgVmConfirmedOrder($cart, $order) {
      
      
              if (!($payment_method = $this->getVmPluginMethod($cart->virtuemart_paymentmethod_id))) {
                  return NULL;
      Severity: Minor
      Found in mercadopago/mercadopago.php - About 1 hr to fix

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

            function paymentNotificationBasic($payment_method){
                $status_http = "HTTP/1.1 200 OK";
        
                if(isset($_REQUEST['topic']) && isset($_REQUEST['id']) && !is_null($_REQUEST['id'])){
                    if($_REQUEST['topic'] == "merchant_order"){
        Severity: Minor
        Found in mercadopago/mercadopago.php - About 1 hr to fix

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

            static function overOnePaymentsIPN($merchant_order){
          
              $total_amount = $merchant_order['total_amount'];
              $total_paid_approved = 0;
              $payment_return = array(
          Severity: Minor
          Found in mercadopago/mercadopago/helpers/mercadopago.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 postCreditCardPaymentV1 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              function postCreditCardPaymentV1($cart, $order, $payment_method){
          
                  // DELETE
                  // require(VMPATH_ROOT . DS.'plugins'.DS.'vmpayment'.DS.'mercadopago'.DS.'mercadopago'.DS.'lib'.DS.'test.php');
          
          
          Severity: Minor
          Found in mercadopago/mercadopago.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 paymentNotificationV1 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              function paymentNotificationV1($payment_method){
                  $status_http = "HTTP/1.1 200 OK";
          
                  if(isset($_REQUEST['type']) && $_REQUEST['type'] == 'payment' && isset($_REQUEST['data_id'])){
                      $payment_id = $_REQUEST['data_id'];
          Severity: Minor
          Found in mercadopago/mercadopago.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

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

              protected function checkConditions($cart, $method, $cart_prices) {
          
                  //$this->convert ($method);
          
                  $address = (($cart->ST == 0) ? $cart->BT : $cart->ST);
          Severity: Minor
          Found in mercadopago/mercadopago.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

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

              function postPreferenceCheckout($cart, $order, $payment_method){
          
                  $this->logInfo('--------------------------------------', 'debug');
                  $this->logInfo('Create Preference: ' . date("Y-m-d H:i:s"), 'debug');
                  $this->logInfo('Order Data: ' . json_encode($order['details']), 'debug');
          Severity: Minor
          Found in mercadopago/mercadopago.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 getPhoneFromOrder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              function getPhoneFromOrder($order){
                  //Valida se existe telefone disponĂ­vel
          
                  $phone = $order['details']['BT']->phone_1;
          
          
          Severity: Minor
          Found in mercadopago/mercadopago.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

                  return $this->postPreferenceCheckout($cart, $order, $payment_method);
          Severity: Major
          Found in mercadopago/mercadopago.php - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language