public static function maxExcessCapturePercent($gateway)
    {
        $setting = self::getConfigSetting($gateway, 'max_capture');
        if (!$setting) {
            return 0;
        }

        $pattern = '/^(\d+)%$/';

        if (!is_array($setting)) {
            if (preg_match($pattern, $setting, $match)) {
                return $match[1];
            }

            if (is_numeric($setting) && $setting > 0) {
                return -1;
            }
        } elseif (!empty($setting['percent'])) {
            if (is_numeric($setting['percent'])) {
                return max(0, $setting['percent']);
            }

            if (preg_match($pattern, $setting['percent'], $match)) {
                return $match[1];
            }
        }

        return 0;
    }
public static function maxExcessCapturePercent($gateway)
    {
        $setting = self::getConfigSetting($gateway, 'max_capture');
        if (!$setting) {
            return 0;
        }

        $pattern = '/^(\d+)%$/';

        if (!is_array($setting)) {
            if (preg_match($pattern, $setting, $match)) {
                return $match[1];
            }

            if (is_numeric($setting) && $setting > 0) {
                return -1;
            }
        } elseif (!empty($setting['percent'])) {
            if (is_numeric($setting['percent'])) {
                return max(0, $setting['percent']);
            }

            if (preg_match($pattern, $setting['percent'], $match)) {
                return $match[1];
            }
        }

        return 0;
    }
public static function maxExcessCapturePercent ( $ gateway ) { $ setting = self :: getConfigSetting ( $ gateway , 'max_capture' ) ; if ( ! $ setting ) { return 0 ; } $ pattern = '/^(\d+)%$/' ; if ( ! is_array ( $ setting ) ) { if ( preg_match ( $ pattern , $ setting , $ match ) ) { return $ match [ 1 ] ; } if ( is_numeric ( $ setting ) && $ setting > 0 ) { return - 1 ; } } elseif ( ! empty ( $ setting [ 'percent' ] ) ) { if ( is_numeric ( $ setting [ 'percent' ] ) ) { return max ( 0 , $ setting [ 'percent' ] ) ; } if ( preg_match ( $ pattern , $ setting [ 'percent' ] , $ match ) ) { return $ match [ 1 ] ; } } return 0 ; }
Get the max excess capture percentage for the given gateway.

Some payment providers allow capturing a slightly higher amount than was authorized.
If $200.00 was authorized and maxExcessCapturePercent returns `15`, you're allowed to capture at max $230.00,
unless further restricted by maxExcessCaptureAmount.
To get the correct max-capture amount, both maxExcessCapturePercent and maxExcessCaptureAmount
have to be considered.

@param string $gateway the gateway name
@return int|string max excess capture percentage as a number (no percentage sign) or `-1` if the
excess capture percentage is not limited (will only occur if there's a limited fixed amount)
@see maxExcessCaptureAmount
Get the max excess capture percentage for the given gateway .