Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-82372

Review payment gateway typings

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.4, 4.5
    • Payments
    • MOODLE_404_STABLE, MOODLE_405_STABLE

      Hello everyone,
      payment processors usually take comissions with floating point, 1.5%, 2.9%...
      Not sure why Moodle architects used INT so i suggent to change it to FLOAT

      /**
      * This functions adds the settings that are common for all payment gateways.
      *
      * @param \admin_settingpage $settings The settings object
      * @param string $gateway The gateway name prefixed with paygw_
      */
      public static function add_common_gateway_settings(\admin_settingpage $settings, string $gateway): void {
      $settings->add(new \admin_setting_configtext($gateway . '/surcharge', get_string('surcharge', 'core_payment'),
      get_string('surcharge_desc', 'core_payment'), 0, PARAM_INT));
      }

      to

      /**
      * This functions adds the settings that are common for all payment gateways.
      *
      * @param \admin_settingpage $settings The settings object
      * @param string $gateway The gateway name prefixed with paygw_
      */
      public static function add_common_gateway_settings(\admin_settingpage $settings, string $gateway): void {
      $settings->add(new \admin_setting_configtext($gateway . '/surcharge', get_string('surcharge', 'core_payment'),
      get_string('surcharge_desc', 'core_payment'), 0, PARAM_FLOAT));
      }

      in file: /payment/classed/helper.php

       

      Note from Matt: We should also review the typing across other variables. Whilst triaging I noticed that both cost and amount typings also flicker between strings, floats and text.

            Unassigned Unassigned
            errand Aleksandr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.